in reply to regex issue
Using a hash would be better. Try this
BUT if you really want to use symbolic reference(which I really advise against) you could use this.
my %data; while(<DATA>){ chomp; my $val = <DATA>; chomp($val); $data{$_} = $val; } use Data::Dumper; print Dumper \%data; __DATA__ A 33 B 22 __OUTPUT__ $VAR1 = { 'A' => ' 33', 'B' => ' 22' };
BUT if you really want to use symbolic reference(which I really advise against) you could use this.
while(<DATA>){ chomp; my $val = <DATA>; chomp($val); $$_ = $val; } print "A: $A\n"; print "B: $B\n"; __DATA__ A 33 B 22
- Tom
In Section
Seekers of Perl Wisdom