in reply to if-elsif weirdness
will warn that there's an uninitialized value at line 1 (even though it's at line 4), but it will properly tell you about the uninitialized value on line 5 (because each new statement in Perl is a new Cop).if ($x) { print 1; } elsif ($x != 2) { print $y; }
A similar problem is found in this case:
Even though the code spans five lines, error messages will refer to the line the statement started on.print 1, 2, 3, undef, 4;
It's not going to be easy to fix this bug, methinks.
Update: but a good kludgy work-around is to use a do { ; ... } block!
That properly reports the warning for line 2. It's super-kludge, though.if ($x) { ... } elsif (do {; $x == 2}) { ... }
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|