Slightly off topic but you can also use an anonymous function rather than the eval. This is what I quickly came up with:
#!/bin/env perl use strict; use warnings; use 5.012; my ($a, $b, $c); $a = $b = $c = 0; foreach my $v (qw/a b c/) { func($v); } sub func { my $in = shift; say "passed in: $in"; print "returned: "; return sub { my $in = shift; say $in x 2; }->($in); }
In reply to Re: eval & variable names?
by ricDeez
in thread eval & variable names?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |