spencerogden has asked for the wisdom of the Perl Monks concerning the following question:
This snippet of code gives the warning "Use of uninitialized value in string eq"
This is in a subroutine, hence the use of @_. The warn and print statements are for debugging this warning, and both show this hash key to hold the value "N". A defined($data{'FLOATER'}) returns true. What am I missing?my %data = @_; warn $data{'FLOATER'}; print $data{'FLOATER'}."<-----------"; if( $data{'FLOATER'} eq 'Y' ){
I have searched for similar problems with this error string, but it is so common that I haven't found anything useful. I have tried different combos of quotes around the hash key, and the constant 'Y'. Nothing seems to matter. I have also seen the same warning with similar code, but different values.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Confusing Uninitialized warning
by kaif (Friar) on Jun 13, 2005 at 16:24 UTC | |
by spencerogden (Initiate) on Jun 13, 2005 at 17:17 UTC | |
|
Re: Confusing Uninitialized warning
by ikegami (Patriarch) on Jun 13, 2005 at 16:18 UTC | |
|
Re: Confusing Uninitialized warning
by Joost (Canon) on Jun 13, 2005 at 16:20 UTC | |
|
Re: Confusing Uninitialized warning
by davidrw (Prior) on Jun 13, 2005 at 16:21 UTC |