http://www.perlmonks.org?node_id=280163


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;