in reply to Use of uninitialized value
A 'string' is a variable with some text in it.
But yours doesn't have anything in it, it's empty.
It's empty because you haven't put anything in it.
On whatever line the error's coming up, Perl is expecting that there should be something in it.
Perl is warning you that you could have made a mistake.
Here's an example that produces the same error:
Here Perl complains about an uninitialised value, because I'm checking to see if $foo equals "yes" when I haven't put anything at all in $foo. If I started off by saying my $foo = 'no' or even my $foo = '' then the warning wouldn't appear.use warnings; my $foo; if ($foo eq "hey!") { print "yes" }
Hope that helps.
(by the way: sorry if any of this sounds patronising: your question was pretty short so I couldn't tell what you already knew, so I thought it better to start from first principles as much as I could. Hope that's OK).
|
|---|