Main( @ARGV ); exit( 0 ); sub Main { my( $command, @args ) = @_; my %commands = ( example => \&Example, help => \&Help ); my $action = $commands{lc $command} || \&Help; $action->( @args ); } sub Example { my( $infile, $outfile ) = @_; use autodie; open my $out, '>', $outfile ; ... }