Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Using Variable Value as Variable Name

by umama (Initiate)
on Jun 28, 2012 at 14:25 UTC ( [id://978949]=note: print w/replies, xml ) Need Help??


in reply to Re: Using Variable Value as Variable Name
in thread Using Variable Value as Variable Name

Additional info... my reason for doing this is that I'm processing text files for loading to a database and the column order can vary by file.

Replies are listed 'Best First'.
Re^3: Using Variable Value as Variable Name
by kennethk (Abbot) on Jun 28, 2012 at 14:41 UTC
    A hash is a much more natural way of dealing with this, and IMHO one of Perl's greatest strengths (the other being regular expressions). You could even use lock_keys from Hash::Util to protect yourself from typos.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-19 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found