Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Keep It Simple, Stupid
 
PerlMonks  

Re: another 'array to hash' question

by tcf22 (Priest)
on Dec 10, 2003 at 09:32 UTC ( [id://313722]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to another 'array to hash' question

Normally doing this is not good practice. If you need the variable names, then you should most likely use a hash.

Here is an example of using an array to build a hash, which may help you, based on the title of your post.
#!/usr/bin/perl -w use strict; use Data::Dumper; my @keys = qw( fn ln age ); my @values = qw( Joe McCarty 89 ); my %hash; @hash{@keys} = @values; print Dumper \%hash;

- Tom

Replies are listed 'Best First'.
Re: Re: another 'array to hash' question
by punkish (Priest) on Dec 10, 2003 at 10:07 UTC
    y'know... this might work in my above code example. Thanks for this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://313722]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.