in reply to Puzzling warning "Use of unitialized value" in very simple code

There are a few known bugs in perl 5.8.8 where the line number of a warning is incorrectly reported. Also warnings are reported for the first line in which an if starts, and warnings from subsequent conditions (sometimes?) wrongly report to be on that same line.

Perl 5.10.0 has the nice feature that it tells you exactly which variable is actually undefined, so running your script under perl 5.10.0 might shed some light on your problem.

It might also help to give us an example password (not a real one ;-) ) that throws the "uninitialized" warning.

  • Comment on Re: Puzzling warning "Use of unitialized value" in very simple code
  • Download Code

Replies are listed 'Best First'.
Re^2: Puzzling warning "Use of unitialized value" in very simple code
by gizmonic (Initiate) on Oct 29, 2008 at 22:08 UTC
    Moritz, thank you! You have saved my sanity.
    Also warnings are reported for the first line in which an if starts, and warnings from subsequent conditions (sometimes?) wrongly report to be on that same line.
    I was getting the exact same error, and searching fruitlessly for the answer hence landing here, and sure enough, it was a typo farther down the eslif's and not at the line in question. I thought I was going nuts there. :) (running 5.8.5 on solaris 9 if anyone cares)