Mark Bilk wrote:
> here's the fixed version of my code:
> -------------------
> s = "abc"
> f(s)
> 
> BEGIN {
> def f(x)
>     print('f: ', x, "\n")
> end
> }
> -------------------
A friend thought of another way,
that avoids even the BEGIN hack:

def mainn
    s = "abc"
    f(s)
end

def f(x)
    print('f: ', x, "\n")
end

mainn
-------------------
-- 
Posted via http://www.ruby-forum.com/.