Hello, Are you sure that %THE_COMMANDS( open => &dosomething ); is not %THE_COMMANDS( open => \&dosomething );
The \ in front of the & makes $THE_COMMAND{open} a code reference. And the way you dereference a code ref is with the -> operator. It's the same as if I did. my $open = \&dosomething; $open->($THE_COMMAND); You can get a better understanding of references from here: http://www.perlmonks.org/index.pl?node_id=137108 Hope this helps, Robert Boone On Fri, 2005-01-14 at 12:10 -0500, radhika sambamurti wrote: > Hi, > I am the "maintenance programmer" for this large chunk of code. My > question is particular to this syntax: > > $THE_COMMANDS{$THE_COMMAND}->($THE_COMMAND); > Where THE_COMMANDS is a hash > > %THE_COMMANDS( open => &dosomething ); > Thus, $THE_COMMANDS{$THE_COMMAND} is nothing but &dosomething right? > so why cant I issue the command by saying: $THE_COMMANDS{$THE_COMMAND}; > I tried that and it did not work. > I actually had to use: $THE_COMMANDS{$THE_COMMAND}->($THE_COMMAND); > I guess I am a bit confused. Any help in way of what to read further to > aid my understanding of this would also be helpful. > > thx, > radhika > > -- > It's all a matter of perspective. You can choose your view by choosing > where to stand. > Larry Wall > --- > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>