Why have I avoided sorting out subroutine references in my head for so long? The following has taken me about five minutes to get to grips with, and would have been incredibly useful in any of my previous projects....
my %comms = ( 'one' => \&subone, 'two' => \&subtwo, ); my $subref = $comms{'one'}; &$subref('item');
It still surprises me that Perl just keeps on making your job easier and easier the more you know about it.
ho hum, onwards.......

Replies are listed 'Best First'.
RE: subroutine references
by merlyn (Sage) on Jul 14, 2000 at 18:37 UTC
      fantastic :-), I'd tried:
      $comms{'one'}();
      to no avail!, hadnt thought of the -> option
        you could also do:
        &{$comms{one}}('item');