in reply to Problem with strict "refs"
I suspect it will be easier to do the following:
use strict; use warnings; use IO::File; my $filename = 'nt_data.txt'; my $fh = IO::File->new($filename) || die "Cannot open '$filename' for reading: $!\n"; my @nt_data; while (<$fh>) { chomp; my %x; foreach (split /,/) { my ($k, $v) = split /\s*=\s*/; # This line becomes unnecessary ... you weren't using $hashname anyway +s ... # if ($key =~ /^(LocalTran)(\w*)(Number)$/) { $hashname=$value; +} $x{$k} = $v; } push @nt_data, \%x; } $fh->close;
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|