in reply to eval code generation - parameters & return values

Why didn't you try it yourself?

You would have seen that the first example throws a syntax error and the second example does not run under 'use strict' or when not running under the usual strictures, it gives an "Undefined subroutine &main::return $_[0] + $_1;" error.

Those last errors are tips in the right direction: they tell you that your syntax expects a subroutine reference in your variable. It also tells you that it is probably not a good idea to do it as it violates the principles of 'use strict'.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics
  • Comment on Re: eval code generation - parameters & return values