Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Perl-ish way to create hash from array

by LanX (Chancellor)
on Jul 09, 2013 at 17:29 UTC ( #1043359=note: print w/replies, xml ) Need Help??

in reply to Perl-ish way to create hash from array

maybe hash-slices are what you want:

DB<101> @columns=qw(firstname middlename lastname) => ("firstname", "middlename", "lastname") DB<102> @colidx{@columns}=0..$#columns => (0, 1, 2) DB<103> $colidx{middlename} => 1 DB<104> \%colidx => { firstname => 0, lastname => 2, middlename => 1 }

Cheers Rolf

( addicted to the Perl Programming Language)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043359]
[dazz]: At present, I am saving the Image::Grab image to disk, then creating a new Image::Magick object that reads the disk file.
[dazz]: .
[choroba]: Discipulus Sounds interesting. Any pictures of the puppets or paintings?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-03-27 07:44 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (317 votes). Check out past polls.