I'm trying to grab a 3D vector as a single command line input argument using Perl (v5.14.2).
After going through the Getopt::Long documentation, I decided to start with this:
use Getopt::Long;
my @boxSize = (0, 0, 0);
GetOptions('box:f{3}' => \@boxSize);
print "Box size: $boxSize[0], $boxSize[1], $boxSize[2]\n";
Running this script with the arguments -box 1.0 2.0 3.0
yields:
Box size: 0 0 0
Now, if I leave @boxSize
uninitialized:
use Getopt::Long;
my @boxSize; #= (0, 0, 0);
GetOptions('box:f{3}' => \@boxSize);
print "Box size: $boxSize[0], $boxSize[1], $boxSize[2]\n";
The same script now returns:
Box size: 1.0 2.0 3.0
Can anyone tell me what I'm doing wrong?