Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Hash and arrays

by thinker (Parson)
on Aug 04, 2005 at 08:48 UTC ( #480723=note: print w/ replies, xml ) Need Help??


in reply to Re: Hash and arrays
in thread Hash and arrays

Or, in a similar way, use a hash slice to populate the hash

#!/usr/bin/perl use strict; use warnings FATAL => "all"; use Data::Dumper; my @k = ("a", "b", "c"); my @v = (1, 2, 3); my %h; @h{@k} = @v; print Dumper \%h; __END__ output $VAR1 = { 'c' => 3, 'a' => 1, 'b' => 2 };

cheers

thinker


Comment on Re^2: Hash and arrays
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-07-23 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (152 votes), past polls