use strict; use warnings; use Getopt::Long; # ignore unknown options Getopt::Long::Configure("pass_through"); my ($afile, $adir); print "ARGV before: ".join(" ", @ARGV)."\n"; GetOptions( # do not add --job, do not add any options meant to be for --job '--file=s' => \$afile, '--dir=s' => \$adir, ) or die "error in command line\n"; print "ARGV after: ".join(" ", @ARGV)."\n";