Thanks for suggestions, but I'm afraid that initializing the array with references instead of string literals would require lots of work in the context I'd need it.
I actually stumbled upon this, but it relies on no strict 'refs', and I'm left wondering if there's a way to do something similiar with use strict?
my @ary = qw( test another_test third_test ); my $sub_i_want_to_call = $ary[rand(@ary)]; { no strict 'refs'; &{$sub_i_want_to_call}; }
In reply to Re^3: How to call sub defined in a variable?
by jh-
in thread How to call sub defined in a variable?
by jh-
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |