in reply to references to subroutines

You want a dispatch table.
my %dispatch = ( add => \&add, multiple => \&multiply, ); my ($action, @args) = @ARGV; if ( exists $dispatch{ $action } ) { my $rv = $dispatch{ $action }->( @args ); print "Result of '$action' is '$rv'\n"; } else { warn "Invalid action '$action'\n"; }

Also, look in List::Util for better versions of your add and multiply routines.


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?