in reply to using a sub routing as an argument
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)
|
|---|