in reply to Expanding Variable Names in Calls to Subroutines
You can also generate references to named subroutines with \&foo.@runs = ( sub { print "This is one subroutine\n"; }, sub { print "This is another subroutine\n"; }, # etc ); $_->() foreach @runs;
Another way to do it is to use symbolic references, but that is Not Recommended. See strict for details and strict.pm for details of why to use strict to guarantee that you do not accidentally make that mistake.
|
|---|