in reply to Parsing command-line arguments in a sophisticated way.

Use -- to separate the script's options from the options of the job, or even the job itself:
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use Getopt::Long; GetOptions('file=s' => \ my $file, 'dir=s' => \ my $dir); say "Running $ARGV[0] with the following arguments:"; say for @ARGV[1 .. $#ARGV];

Example usage:

$ 1229381.pl --file file.1 --dir dir.2 -- some-job x y z Running some-job with the following arguments: x y z

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]