in reply to Re^3: Make $^V and "my" implicit
in thread Make $^V and "my" implicit
The second example (preventing warnings) can just as easily use || and get the same results as //. That said, I have used your example many, many times when writing for a closed environment, mostly for the reasons you give.
No, it cannot, as 0 in most cases is a valid value, very valid. With || it would be replaced.
Just use it, and see how many unmeant problems suddenly disappear.
Where || does work well, is when the default for a value is 0, most of which are boolean-like values:
my $hidden = $cell->{Hidden} || 0;
true values stay, false values (undef, "", 0 and "0" all get replaced with 0. Replacing 0 with 0 does not hurt.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Make $^V and "my" implicit
by boftx (Deacon) on Feb 04, 2014 at 07:38 UTC | |
by ikegami (Patriarch) on Feb 05, 2014 at 18:29 UTC | |
by Tux (Canon) on Feb 04, 2014 at 08:11 UTC |