in reply to Trickery with Getopt::Long (flag option, with optional integer arg)
Use the :i specifier. Refer to Summary of Option Specifications.
use warnings; use strict; use Getopt::Long; my $arg = -1; GetOptions('arg:i' => \$arg) or die; print "$arg\n";
In Section
Seekers of Perl Wisdom