Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Slice of a multi-level hash

by davidfilmer (Sexton)
on Oct 16, 2014 at 23:25 UTC ( [id://1104128]=perlquestion: print w/replies, xml ) Need Help??

davidfilmer has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Masters. This hash slice works exactly as expected:
my %fruit; $fruit{'apple'} = 'red'; @fruit{'lemon', 'lime'} = ( 'yellow', 'green' ); print Dumper \%fruit;
This, however, throws a syntax error on the slice, even though the syntax is comparable:
my %auto; $auto{'ford'}{'F150'}{'color'} = 'RED'; @auto{'ford'}{'F150'}{'tires','lights'} = ('ALL SEASON','HALOGEN'); print Dumper \%auto;
What is the proper syntax for a slice of a multi-level hash? This is perl v5.12.1, FWIW.

With gratitude for your 'perls' of wisdom.

Replies are listed 'Best First'.
Re: Slice of a multi-level hash
by LanX (Saint) on Oct 16, 2014 at 23:35 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-18 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found