in reply to Technique for building arguments from function name?
for my $x (qw( cat dog fish )) { no strict 'refs'; *{"function_$x"} = sub { print $x }; } function_cat(); # print "cat" function_banana(); # error
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Technique for building arguments from function name?
by nysus (Parson) on Dec 04, 2017 at 20:01 UTC |