use Getopt::Long qw(:config pass_through); my $run; GetOptions( 'x|run-using-system' => sub { $run = \&system }, 'X|run-using-mysystem' => sub { $run = \&mysystem }, ); $run->(@ARGV);