Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: return more than 1 value

by changma_ha (Sexton)
on Jul 30, 2010 at 06:06 UTC ( [id://852040]=note: print w/replies, xml ) Need Help??


in reply to Re: return more than 1 value
in thread return more than 1 value

@ Utilitarian,i have another question regarding a line of your code. in @returned_values{@{$keys}} = @{$values}; how did u take a %returned_values as an array? i mean i am not getting this line properly. Thanks in advance

Replies are listed 'Best First'.
Re^3: return more than 1 value
by Utilitarian (Vicar) on Jul 30, 2010 at 07:16 UTC
    @hash{@array_of_keys}=@array_of_values;
    Is the Perlish way of assigning an array of values to their equivalent keys. You could, (if you enjoy typing), write
    for my $index (0..$#array_of_keys){ $hash{$array_of_keys[$index]}=$array_of_values[$index]; }
    In the line you cite there isn't an array @returned_values it is a hash slice. take a look at the perldata man page for further, better presented, info

    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2025-06-23 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.