nysus has asked for the wisdom of the Perl Monks concerning the following question:
Here's my newbie code that works:$household = { 23 => { last => 'Smith', first => 'Mary' }, 22 => { last => 'Jones', first => 'Bob' } };
How do I turn this into a one liner?my $key = 23; my $person = $household->{$key}; my %name = %$person; my @slice = @name{'first', 'last'};
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
$nysus = $PM . $MCF;
Click here if you love Perl Monks
|
---|
Replies are listed 'Best First'. | |
---|---|
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 | |
by nysus (Parson) on Oct 07, 2015 at 15:40 UTC | |
Re: Slicing a hash reference from a collection of hash references within a hash reference
by toolic (Bishop) on Oct 07, 2015 at 15:36 UTC | |
Re: Slicing a hash reference from a collection of hash references within a hash reference
by johngg (Canon) on Oct 07, 2015 at 23:08 UTC | |
Re: Slicing a hash reference from a collection of hash references within a hash reference
by Anonymous Monk on Oct 07, 2015 at 17:11 UTC | |
by muba (Priest) on Oct 08, 2015 at 02:27 UTC |