If the value is optional, use a colon
#Getopt::Long::GetOptions('number_copies:i' => \$copies); #!/usr/bin/perl -w use Getopt::Long; Getopt::Long::GetOptions( 'number_copies:i' => \$copies); if ( defined( $copies ) ) { print "number_copies flag set to $copies\n"; }