use Getopt::Long; my @foo; GetOptions( 'foo=s@' => \@foo, ) or exit 255; # ./script --foo alpha --foo beta say $_ for @foo;