use Getopt::Long; GetOptions( 'foo=s@' => \my @opt_foo, ) or exit 255; print $_."\n" for @opt_foo;