On 1/26/07, Adriano Ferreira <[EMAIL PROTECTED]> wrote:
On 1/26/07, Jen Spinney <[EMAIL PROTECTED]> wrote:
> Hello list!
>
> I apologize in advance for not posting a complete sample script that
> shows my problem, but I can't isolate it outside of my (rather large)
> perl application.
>
> My problem is that I'm hit with a barrage of warnings that tell me I'm
> using uninitialized values.  The first warning that occurs complains
> of a "use of uninitialized value in string eq" at line 505 of my
> script.  Line 505 (I've triple-checked the line number and the correct
> source) reads:
>
> if ($exploit_name eq 'ALL') # <-- line 505
>
> I had no idea how $exploit_name could be undefined, so I added the
> following two statements right before the if statement:
>
> print "\$exploit_name is not any sort of false\n" if $exploit_name;
> print "String literal is not any sort of false\n" if 'ALL';
> if ($exploit_name eq 'ALL') # <-- now line 507

To see what you really got at $exploit_name, use Data::Dumper,
Data::Dump or any of your favourite dumpers:

    use Data::Dump qw(dump);
    print "\$exploit_name =", dump($exploit_name), "\n";

In some circumstances, the line of the warning may be wrong. So the
problem can be around line 507 instead of exactly there.


$exploit_name isn't a reference, but a string scalar.

Right before the if statement, I added these lines:
print "\$exploit_name = $exploit_name\n";
print "\$exploit_name = ", Dumper($exploit_name), "\n";

This outputs:
$exploit_name = icecast_header
$exploit_name = $VAR1 = 'icecast_header'

Followed by the same warning.

Maybe it is on another line.  Weird.  I'll peruse around my code a bit more...

Thanks for the quick response, Adriano!
- Jen

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to