Asfand Yar Qazi wrote: > Asfand Yar Qazi wrote: > >>> >>> Just realized how to fix that: >>> >>> def empty_binding >>> binding >>> end >>> >>> def eval_string(s, *args_to_pass) >>> pr = eval("proc do |*args| #{s.to_str} end", empty_binding) >>> pr[*args_to_pass] >>> end >>> >>> eval_string(<<EOL, [1, 2, 3, 4, 5]) >>> b = args.collect {|i| i*3} >>> c = b.join("||") >>> puts(c) >>> #p pr #<-- now this fails >>> EOL >>> > > Just one thing: why the use of 'proc do ... end ' rather than lambda? I > know there's a difference, but I'm not sure what. AFAIK, lambda and proc are the same in ruby. But there may have been some talk about deprecating proc in the future.