I'm experiencing a scope problem that I can't figure out. I'm using warnings, and I get the following warning: "Use of uninitialized value $f1missing in numeric eq (==) at C:\scripts\DailyComp2.7.pl line 520 (#1)" At this point in the script, I'm using NET::Telnet and I'm in a telnet session. Here's the chunk of code that's producing the warning:

# Check for error that first input file can't be found my $f1missing = 0; $f1missing = $t->waitfor(String => 'That file is unavailable', errmode => 'return'); if ($f1missing == 1) { print "\nFirst input file $prevcomp is missing!!\n"; $t->print(); # Send Enter for prompt $t->print(); # Send Enter to exit COMPARE $CTYPE = 0; # Set Compare type back to 0 to avoid running COMPARE r +eport again $ETYPE = 1; # Set error type to 1 return; # Exit subroutine }

I initialize the value right before I use it in the if function, so why would it produce an uninitialized value warning here? As always, any help would be appreciated.


In reply to Scope Issue by MKJ747

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.