script.pl -x opt1 -x opt2 -x opt3 #### my @x; my @y; my $z; GetOptions( #three options required 'x=s' => sub { shift(); push(@x, shift, shift(@ARGV), shift(@ARGV)); }, #two options required 'y=s' => sub { shift(); push(@y, shift, shift(@ARGV)); }, 'z=s' => \$z) or die ("Invalid arguments");