Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: converting an array to an hash

by karlgoethebier (Abbot)
on Dec 22, 2014 at 20:26 UTC ( [id://1111075]=note: print w/replies, xml ) Need Help??


in reply to Re^4: converting an array to an hash
in thread converting an array to an hash

I guess. Do you mean this?

#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my @data = ( [ 3, 4, 5, 1 ], [ 1, 2, 3, 4 ], [ 3, 3, 1, 6 ] ); my %hash = map { $_ => $data[$_] } 0 .. $#data; print Dumper \%hash; __END__ $VAR1 = { '0' => [ 3, 4, 5, 1 ], '1' => [ 1, 2, 3, 4 ], '2' => [ 3, 3, 1, 6 ] };

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-24 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found