my %dispatch = ( job1 => \&sub1, job2 => \&sub2, ); my $sub = \&default_sub; $sub = $dispatch{ $ARGV[0] } if exists $dispatch{ $ARGV[0] }; $sub->();