sub test { print "Hello world!\n"; } my $subroutine = "test"; &{$subroutine};
The caveat to this approach is that it breaks strict refs unless the $subroutine scalar is evaluated (eg. eval $subroutine).
Update - Check out the nifty example from broquaint in this thread here
perl -e 'print+unpack("N",pack("B32","00000000000000000000000111010010")),"\n"'
In reply to Re: Re: variable function thingy
by rob_au
in thread variable function thingy
by nujersedvl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |