Help for this page

Select Code to Download


  1. or download this
    sub mysub { print "mysub $_[0]\n"; }; 
    my $s="mysub"; 
    &{$s}( "toto");                         # This is what you want
    
  2. or download this
    my %h=( mysub1 => \&mysub_1,  # \&mysub_1 is a reference to the subrou
    +tine
            mysub2 => \&my_sub_2);
    ...
    
    sub mysub_1 { print "mysub 1 $_[0]\n"; }; 
    sub mysub_2 { print "mysub 2 $_[0]\n"; };