Here is an example...
#Setup a Dispach table.... command => \&Dispatch_Sub my %cmd = (clean=> \&Clean , quit=> \&Quit); my $entry=shift; # Get user input from @ARGV or Elsewhere #This is the Main dispatch. # First - check to see if the user command is valid. # If so, Dispatch (Call the corresponding sub). If not, complain. $cmd{$entry} ? $cmd{$entry}() : print qq/no such comand $entry\n/; sub Clean{ # This is the called DISPACH sub print qq/Running clean\n/; } sub Quit{ exit; }
Earth first! (We'll rob the other planets later)
In reply to Re: using a sub routing as an argument
by NetWallah
in thread using a sub routing as an argument
by gitarwmn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |