in reply to call subroutines via hash
You need an explicit arrow operator to dereference (i.e. call) the subroutine.
$dispatch{$input}->()
(Update: First impressions are not always right. Thanks, Eric and Roy for catching my mistake.)
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: call subroutines via hash
by Roy Johnson (Monsignor) on Jan 04, 2006 at 21:05 UTC | |
|
Re^2: call subroutines via hash
by eric256 (Parson) on Jan 04, 2006 at 21:02 UTC |