Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Slicing a hash reference from a collection of hash references within a hash

by stevieb (Canon)
on Oct 07, 2015 at 15:35 UTC ( [id://1144072]=note: print w/replies, xml ) Need Help??


in reply to Slicing a hash reference from a collection of hash references within a hash reference

First thing is, use strict; and use warnings;. There are syntax errors in the code you specified.

Here's one way to extract out the hash slice you need...

use warnings; use strict; my $household = { 23 => { last => 'Smith', first => 'Mary' }, 22 => { last => 'Jones', first => 'Bob' }, }; my $name = join ' ', @{ $household->{23} }{'first', 'last'};

-stevieb

Replies are listed 'Best First'.
Re^2: Slicing a hash reference from a collection of hash references within a hash
by nysus (Parson) on Oct 07, 2015 at 15:40 UTC
    Thank you! Looks so damn obvious once you see the solution.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-24 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found