In Perl getopts, is it possible to use the same option multiple times but with different values ? I want to give the user the option of entering different grid coor
getopts
As documented in Getopts::Long - Options with multiple values:
#!/usr/bin/perl use strict; use warnings; use Getopt::Long; GetOptions( "coords=s" => \my @coords, ); print "$_\n" for @coords;
Executed using:
my_grid.pl --coords=10,12 --coords=-18,30 --coords=4,-25
Outputs:
10,12 -18,30 4,-25