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

Re^2: problem with array of hashes

by tobyink (Abbot)
on Oct 09, 2012 at 10:47 UTC ( #997974=note: print w/ replies, xml ) Need Help??


in reply to Re: problem with array of hashes
in thread problem with array of hashes

So does:

my ($value) = map { join('array of hashes', 41) } $VAR;

Update: added parentheses. Thanks McA.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re^2: problem with array of hashes
Download Code
Re^3: problem with array of hashes
by McA (Priest) on Oct 09, 2012 at 11:17 UTC

    Oh, oh, oh

    Guys, look at this:

    use strict; use warnings; use Test::More tests => 2; my $the_ultimate_answer = 42; my $VAR1 = [ { '201' => 'i', '101' => 'f', '41' => 't', } ]; is(+(sort { $a <=> $b } keys %{ $VAR1->[0] })[0], $the_ultimate_answer +, 'Testing for ultimate answer'); my $value = map { join('array of hashes', 41) } $VAR1; is($value, $the_ultimate_answer, 'Testing for ultimate answer');

    The second proposal is more wrong than I expected. ;-)

Re^3: problem with array of hashes
by wirito (Acolyte) on Oct 10, 2012 at 13:03 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2015-07-06 01:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls