After reading the documentation, I believe this can be done by changing use Getopt::Long; to use Getopt::Long qw(:config require_order);.
require_order
Whether command line arguments are allowed to be mixed with options. Default is disabled unless environment variable POSIXLY_CORRECT has been set, in which case require_order is enabled.
See also permute, which is the opposite of require_order.
Getopt::Long will stop processing flags and such once it sees an argument without a dash.
And you didn't even know bears could type.
In reply to Re^3: Usage of flags in scripts
by Lawliet
in thread Usage of flags in scripts
by jordandanford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |