Link to home
Start Free TrialLog in
Avatar of illuzian
illuzianFlag for Australia

asked on

Perl Getopt::Long - Error in option spec

I'm trying to run a script I wrote on a Linux Box on an AIX machine but it seems to error our, it works flawlessly on Linux and the syntaxt looks fine but when I run it on the aix box I get:

Error in option spec: "z|zcat|zip|compressed:s{2}"
Error in option spec: "t|text:s{2}"

Any help would be valued.

Cheers

#!/usr/bin/perl
use Getopt::Long;
 
$tmpfile = "/u/oper/ahawkes/tmp/\$USER.txt";
print "\n";
 
my ($help, @compressed, @text);
##### get options #####
 
usage() if ( ! GetOptions('help|?' => \$help, 'z|zcat|zip|compressed=s{2}' => \@compressed, 't|text:s{2}' => \@text, )
     or defined $help );
 
###---code continues---###

Open in new window

Avatar of ozo
ozo
Flag of United States of America image

what version of Getopt::Long do you have?
Avatar of illuzian

ASKER

Version is 2.34
Avatar of mjcoyne
mjcoyne


Try double quotes:

usage() if ( ! GetOptions("help|?" => \$help, "z|zcat|zip|compressed=s{2}" => \@compressed, "t|text:s{2}" => \@text, )
     or defined $help );
Double quotes still comes up with an error in option spec
ASKER CERTIFIED SOLUTION
Avatar of mjcoyne
mjcoyne

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If an upgrade of the AIX box is not an option can anyone think of an alternative way of achieving the desired result?
You could iterate over the array looking to see if the option is valid using grep...