perl_mystery has asked for the wisdom of the Perl Monks concerning the following question:

Why is options{d} not seen below,if I hardcode this option,the script runs fine

#!/usr/bin/perl -w use strict; use warnings; use IPC::System::Simple qw( system ); use Getopt::Std; use Data::Dumper; #USAGE #Getting the command-line options my %options=(); getopt("fdr",\%options); print Dumper( \%options ); #if (not exists $options{r} || not exists $options{d} || not exists $o +ptions{f}) #{ # print "Please enter the release,description and deleted files + file.\n"; #} system($_) for 'p4 submit -d "options{d}" -f submitunchanged -i', 'p4 label -o -t Test Error message:- If I run using "perl perl.pl -d Check_in -r 1012" I get the below erro +r message p4 submit -d "options{d}" -f submitunchanged -i" unexpectedly returned + exit value 1 at perl.pl line 37

Replies are listed 'Best First'.
Re: options not being seen
by toolic (Bishop) on Mar 08, 2011 at 22:02 UTC
    • You didn't include the $ sigil.
    • Even if you did include the sigil, the single quotes prevent interpolation.

    Maybe qq will help:

    qq(p4 submit -d "$options{d}" -f submitunchanged -i),

      That doesnt seem to work

        Which you can tell how? What error do you get now?

        True laziness is hard work