Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: dynamic scalar names?

by dga (Hermit)
on Aug 01, 2003 at 21:41 UTC ( #280163=note: print w/replies, xml ) Need Help??


in reply to dynamic scalar names?

I would suggest a hash.

my %file_stuff; while(<DATA>) { chop; my($k, $v)=split('='); $file_stuff{$k}=$v; } #later want to know what data was set to print "data was ", $file_stuff{data}, "\n"; __DATA__ data=test other=sample

This keeps the names and keeps them tidy and doesn't pollute your name space. As an added advantage you can look through the keys to see what was defined.

my @defined_stuff=keys %file_stuff;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2021-06-18 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (88 votes). Check out past polls.

    Notices?