Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Autovivification in perl

by choroba (Canon)
on Jan 10, 2014 at 12:42 UTC ( #1070114=note: print w/ replies, xml ) Need Help??


in reply to Autovivification in perl

It makes it possible to write

push @{ $at_line{$string} }, $line_number;

instead of

$at_line{$string} = [] unless exists $at_line{$string}; push @{ $at_line{$string} }, $line_number;
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Autovivification in perl
Select or Download Code
Re^2: Autovivification in perl
by ikegami (Pope) on Jan 10, 2014 at 20:27 UTC
    Well,
    push @{ $at_line{$string} //= [] }, $line_number;
    or even
    push @{ $at_line{$string} ||= [] }, $line_number;
    would do.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (13)
As of 2015-04-21 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who makes your decisions?







    Results (392 votes), past polls