in reply to Re^2: Warning gets the line number wrong?
in thread Warning gets the line number wrong?
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.#!/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"; }
|
|---|