Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 examining the Monastery: (11)
As of 2014-08-20 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls