See perlmod for the gory details of how it works.use strict; use warnings; sub test { print "something"; } sub another_test { print "something else"; } sub third_test { print "another unimaginative statement"; } $\ = "\n"; my @ary = qw( test another_test third_test ); my $sub_i_want_to_call = $main::{$ary[rand(@ary)]}; $sub_i_want_to_call->();
In reply to Re^4: How to call sub defined in a variable?
by Arunbear
in thread How to call sub defined in a variable?
by jh-
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |