Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: How to use 2 files for calculating charges

by Laurent_R (Canon)
on Aug 13, 2013 at 22:02 UTC ( #1049349=note: print w/replies, xml ) Need Help??


in reply to Re: How to use 2 files for calculating charges
in thread How to use 2 files for calculating charges

So my question is, what the heck does //= do?

This is the relatively new "defined or" operator

$a //= $b;

means that $a is unchanged if it is defined, and is assigned to $b if not defined.

At least, that's my understanding, I have never used it, but the following test under the Perl debugger seems to confirm it:

$ perl -de 42 Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 42 DB<1> $a //=5; DB<2> p $a 5 DB<3> $a //=6; DB<4> p $a 5 DB<5>

Replies are listed 'Best First'.
Re^3: How to use 2 files for calculating charges
by BillKSmith (Vicar) on Aug 14, 2013 at 04:13 UTC
    This feature added in perl v5.10.0 Refer perl5100delta:
    and the statement $c //= $d; can now be used instead of $c = $d unless defined $c;
    Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1049349]
help
Chatterbox?
[Corion]: Yeah, I'm thinking more of marketing mailing lists, not public broadcast-style mailing lists
[marto]: yeah, so our hackerspace, we run mailman. that's a public discussion list, not a weekly buy our crap marketing list, people can unsubscribe at any time. What they can't do is delete their mails from the archive, or from the inboxes of our hundreds of user
[Corion]: marto: I'm not sure on how to treat mail archives. I think you could either set an auto-deletion timespan or an auto-anonymisation timespan if you wanted to do it right.

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2018-05-22 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?