= type [ desttype ] [ repeat ] The option requires an argument of the given type. Supported types are: s String. An arbitrary sequence of characters. It is valid for the argument to start with "-" or "--". #### use warnings; use strict; use Getopt::Long qw(GetOptions); my %opt; GetOptions(\%opt, qw(name=s long)) or die; if ( (exists $opt{name}) and ($opt{name} =~ /^-/) ) { die "Option name requires an argument\n"; } #### my %opt; my @string_opts = qw(name foo|goo bar); GetOptions(\%opt, qw(help long), map { "$_=s" } @string_opts) or die; for my $oname (@string_opts) { $oname = (split /\|/, $oname)[0]; # handle alternate names if ( (exists $opt{$oname}) and ($opt{$oname} =~ /^-/) ) { die "Option $oname requires an argument\n"; } }