First, you have unbalanced curly brackets in your posted code. This means I am guessing at how your code is actually structured. In the future, please post code that a monk can just download and run to replicate your issue - see How (Not) To Ask A Question.

Assuming that the cause of your error in present within your code snippet, the warning is being thrown by your print statement. Specifically, variable interpolation within double quotes is implicitly done with the concatenation operator, thus when you attempt to print without first initializing $csa_file, warnings notes you are concatenating with an undefined value. See String interpolation. I suspect this error is the result from your misplaced curly bracket. Perhaps you mean something like this:

#_ 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 file: + $csa_file ($!)";

Some side notes on style:

  1. Generally, the lower precedence or is used in testing in place of the high precedence || you have used to test your file open. It doesn't matter here, but it will matter in similar constructs, such as if you omit parentheses on an argument list.
  2. Foreach constructs tend to be more resilient than C-style for loops. Consider that replacing your for loop with:

    foreach my $i (0 .. $#ARGV)

  3. You are obviously using warnings given then message you report, but are not using strictures. You can avoid a lot of headaches if you use strict.

Update: Your update supports the conclusion that you have a brackets probelm. You are only evaluating the first term of your argument list opening your file and continuing.


In reply to Re: Use of uninitialized value in concatenation (.) or string error after adding new arguement on command line by kennethk
in thread 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.