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

Re: storing variable names in an array

by kirbyk (Friar)
on Jun 10, 2005 at 20:10 UTC ( #465669=note: print w/replies, xml ) Need Help??

in reply to storing variable names in an array

It's possible to do that, but it's not really the easiest way.

Consider using a hash instead:

my %files = ( 'file1' => 'tom', 'file2' => 'bob', 'file3' => 'joe', ); $files{'file2'} = 'sam';
Alternately, just store your filenames in the array (if order is important), like:
my @names = ('tom','bob','joe'); $names[1] = 'sam';
Adding the additional step of the array of variable names is usally the wrong path to go down.

-- Kirby,

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-10-22 07:58 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (293 votes). Check out past polls.