Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 cooling their heels in the Monastery: (10)
As of 2015-07-07 01:00 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 (86 votes), past polls