Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Dynamic addressing in a hash

by AnomalousMonk (Archbishop)
on Sep 01, 2022 at 04:00 UTC ( #11146589=note: print w/replies, xml ) Need Help??


in reply to Re^2: Dynamic addressing in a hash
in thread Dynamic addressing in a hash

$config->{$field} //= {};

// is the Logical Defined-Or operator (see perlop), added with Perl version 5.10. So the example from the Camel book
    $val ||= "2"; # Set $val to 2 if it isn't already "true"
exactly translates to
    $val //= "2"; # Set $val to "2" if $val isn't defined


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2023-02-04 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (30 votes). Check out past polls.

    Notices?