|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^5: Avoiding silly programming mistakesby Limbic~Region (Chancellor) |
| on Aug 20, 2008 at 14:48 UTC ( #705527=note: print w/ replies, xml ) | Need Help?? |
|
JavaFan,
I was showing that perl doesn't issue a warning any time it sees an assignment in a conditional - only when it makes sense. This was intended for others reading along, not for you since you obviously know what you are talking about. This is actually a common idiom, so it would be wrong for Perl to warn. Note that swapping the arguments around won't help you either: ... may be valid (if foo() returns an lvalue). Yep, exactly what I said. Perl assumes you know what you are doing and when flipping operands, an error would happen unless there was an lvalue at play. Cheers - L~R
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||