$ cat opts.pl #!/usr/bin/env perl use strict; use warnings; use Getopt::Long 'GetOptions'; my $arg1; my %opt = ('arg1=s' => \$arg1); GetOptions (%opt); print "arg1 is $arg1\n" if defined $arg1; $ ./opts.pl --arg1=foo arg1 is foo $