You want "string-eval", not "block-eval":
my $ans = eval "$acode; tryme(3)"; if (my $err = $@) { die "Caught error: $err in code [$acode]"; };
In reply to Re: How to interpret a string as perl code and execute it?
by Corion
in thread How to interpret a string as perl code and execute it?
by sg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |