in reply to Re: variable function thingy
in thread variable function thingy

This answer is correct, but I would also add that it is possible to store the subroutine name rather than as code reference. For example:

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"'