in reply to Warning gets the line number wrong?

You haven't shown the entire statement that begins on line 416, presuming it's that "if".

Keep in mind that a statement (including a chain of elsifs) is all considered to begin on its first line, no matter how many lines it spans. So you probably have a <= comparison in some elsif branch that you aren't showing, and one side of that is undef, just as the error says.

Replies are listed 'Best First'.
Re^2: Warning gets the line number wrong?
by Cap'n Steve (Friar) on Apr 30, 2007 at 20:43 UTC
    Wow, I never even knew that. I'm sure there's a reason for that and the undef problem mentioned earlier, but that's incredibly annoying.
      Yes, it's annoying, but once you are aware of it (and get used to it), it's not so tough. Here's a simple demo of the basic pattern:
      #!/usr/bin/perl -w $_ = undef; if ( 1 == 2 ) { # this is line 4 print "This cannot happen\n"; } elsif ( $_ < 3 ) { # the problem is at line 7 print "This works okay (but throws a warning)\n"; }
      You'll see that the warning message cites line 4. Simple rule: when a warning points to an "if" statement and makes no sense for that line, check each of the "elsif" statements that relate to that line.