MKJ747 has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Scope Issue
by Corion (Patriarch) on Mar 15, 2011 at 12:43 UTC | |
|
Re: Scope Issue
by AR (Friar) on Mar 15, 2011 at 13:02 UTC | |
by fidesachates (Monk) on Mar 15, 2011 at 13:12 UTC | |
by AR (Friar) on Mar 15, 2011 at 13:21 UTC | |
by MKJ747 (Acolyte) on Mar 15, 2011 at 13:51 UTC | |
by GrandFather (Saint) on Mar 15, 2011 at 21:03 UTC | |
by Anonymous Monk on Mar 15, 2011 at 13:19 UTC | |
by fidesachates (Monk) on Mar 15, 2011 at 13:23 UTC | |
by MKJ747 (Acolyte) on Mar 15, 2011 at 13:46 UTC | |
by MKJ747 (Acolyte) on Mar 15, 2011 at 15:05 UTC | |
by Corion (Patriarch) on Mar 15, 2011 at 15:08 UTC | |
by MKJ747 (Acolyte) on Mar 15, 2011 at 15:50 UTC |