I'm currently modifying some code and wanted to add an additional argument to the code on the command line. The argument I added is the last one on the list.
#_ Command line options & setup filenames for ($i=0; $i<=$#ARGV; $i++) { if($ARGV[$i] eq "-a") { $alignment_file = $ARGV[$i+1]; } if($ARGV[$i] eq "-s") { $scorecons_file = $ARGV[$i+1]; } if($ARGV[$i] eq "-i") { $image_file = $ARGV[$i+1]; } if($ARGV[$i] eq "-m") { $numbered_model = $ARGV[$i+1]; } if($ARGV[$i] eq "-c") { $csa_file = $ARGV[$i+1]; } print "test $csa_file\n"; #_ Check for minimum number of command line argument variables if($#ARGV < 6) { Usage(); print "NOT ENOUGH COMMAND LINE ARGUMENTS\n"; exit 0; } $fh_csa = new FileHandle($csa_file, "r") || die "Cannot open CSA f +ile: $csa_file ($!)";
The code worked before I added the -c argument - i'm very confused as to why it doesn't work now. It doesn't seem obvious to me. Ay suggestions much appreciated! I know the error means that the $csa_file variable isn't initialized but I fail to see how. I am of course remembering to input said argument at the prompt ;)

In reply to Use of uninitialized value in concatenation (.) or string error after adding new arguement on command line by Angharad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.