if (@ARGV == "clean"){ print "cleaning up dirs"; clean(); } #### if($ARGV[0] eq "clean") { # eq, not ==, for strings print "cleaning up dirs"; clean(); } #### sub clean_handler { print "cleaning up dirs"; clean(); } sub make_handler { print "making project"; make(); } # ... #### my %cmds = ( 'clean' => \&clean, # reference to the subroutine 'clean' 'make' => \&make, # reference to 'make' # ... ); #### my $cmd = $cmds{$ARGV[0]}; # get the coderef &$cmd(); # call it