in reply to Or, Or, Equals Zero, $x ||= 0
Works for strings too: $x ||= '': will avoid warnings about using an undefined value in a print, string concatenation, string comparison, regular expression, and so on.
It's not that undefined values are inherently bad -- sometimes you want a variable to be undef, and if you really want to use undef values in a print or a comparison to some actual value, you can modify the "use warnings" pragma to say which warnings it should ignore. But such "special needs" cases are pretty rare (and probably avoidable).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Or, Or, Equals Zero, $x ||= 0 ('')
by tye (Sage) on Nov 28, 2007 at 05:56 UTC | |
by Erez (Priest) on Nov 29, 2007 at 11:01 UTC |