in reply to How to interpret a string as perl code and execute it?
You want "string-eval", not "block-eval":
my $ans = eval "$acode; tryme(3)"; if (my $err = $@) { die "Caught error: $err in code [$acode]"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to interpret a string as perl code and execute it?
by sg (Pilgrim) on Feb 05, 2011 at 17:03 UTC | |
by Corion (Patriarch) on Feb 05, 2011 at 17:12 UTC | |
by ikegami (Patriarch) on Feb 05, 2011 at 17:16 UTC |