in reply to Re^2: What is the difference between |= and ||=?
in thread What is the difference between |= and ||=?

Please consider using the cleaner perl5.10 variant //= if you expect $some_ref->{id} to be nonexistent / not defined. $some_href->{id} //= 0 This makes it explicit that you only want to set id when it was not defined before. Then the truthy, falsy nature of '', 0 and other variants is no longer of concern.

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

Replies are listed 'Best First'.
Re^4: What is the difference between |= and ||=?
by DrHyde (Prior) on Apr 08, 2009 at 09:40 UTC
    Please don't, unless you can be sure that all your users are on perl 5.10. Remember, 5.10 is still very new, and given that it's 5.10.*0* lots of people will be ignoring it and waiting for 5.10.1, as .0 releases of software are commonly seen as being not really ready for serious use.
Re^4: What is the difference between |= and ||=?
by Anonymous Monk on Apr 08, 2009 at 04:53 UTC

    Ah, I see. Thanks :)

    It's exactly what I need in a few cases. But...hm...the shared server isn't using 5.10 :(