Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In a while loop reading lines from $FH, I get error:
Use of uninitialized value in string eq at file.pm line 103
My code is this:
100 if ( !defined( $data->{$id}{'HOST'} ) ) { 101 printf("no HOST defined at data->{%s}\n", $id); 102 } 103 if ($data->{$id}{'HOST'} eq "" ) { 104 # do this 105 } else { 106 # do that 107 }
I don't see the output from line 101 so there must be something in $data->{$id}{'HOST'}, correct? So how can I possibly get the error from line 103 then?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: if not defined question (indeed)
by tye (Sage) on Sep 10, 2014 at 04:06 UTC | |
|
Re: if not defined question
by LanX (Saint) on Sep 09, 2014 at 21:41 UTC | |
|
Re: if not defined question
by GrandFather (Saint) on Sep 09, 2014 at 22:31 UTC | |
|
Re: if not defined question
by Anonymous Monk on Sep 09, 2014 at 21:51 UTC | |
|
Re: if not defined question
by roboticus (Chancellor) on Sep 09, 2014 at 23:43 UTC | |
|
Re: if not defined question
by Anonymous Monk on Sep 10, 2014 at 01:56 UTC |