Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

defined or: // and //=

by liz (Monsignor)
on Sep 25, 2003 at 15:14 UTC ( #294171=note: print w/ replies, xml ) Need Help??


in reply to 5.8.1 Released!

For those of you who cannot wait until 5.10 and/or Ponie to be able to use "defined or", H. Merijn Brand has uploaded the necessary source patches. When you apply this patch to the 5.8.1 source tree, you get a new operator // (defined-or). This allows you to say

$a // $b
instead of
defined $a ? $a : $b
and
$c //= $d;
instead of
$c = $d unless defined $c;
The operator has the same precedence and associativity as ||.

H. Merijn Brand uses this in his production environments for quite some time already, so it appears to be pretty stable. Of course, using this operator will make your code unportable to "standard" Perl 5.8.1, so YMMV.

Liz


Comment on defined or: // and //=
Select or Download Code
Re: defined or: // and //=
by Abigail-II (Bishop) on Sep 25, 2003 at 20:43 UTC
    I for sure will start using // and //=. Already installed 5.8.1 plus two patching, including the defined-or patch on both my home and work boxes.

    And in case you want to know what the other patch is, it gets rid of the blasted "print (...) interpreted as function" warning.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://294171]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-10-22 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls