A hash of hashes is probably what you should be using. Maybe something like:
open (my $fd, '<','./dump2.txt') or die "Can't open dump2.txt"; while (<$fd>) { chomp; my @dump = split(/\t/); my $tbl_last = "FIL"; my %data; foreach my $it (@dump) { if ($it =~ m/([A-Z]{3})\.(.+)/) { my $tbl = $1; my ($col, $val) = split('=',$2); # print "$it\t$tbl\t$col\t$val\n"; $data{$tbl}->{$col} = $val; } } print Dumper(\%data);
You can learn more about such data structures by reading perldsc.
In reply to Re: how to initiate an array or an hash with name from captured string in pattern matching?
by ig
in thread how to initiate an array or an hash with name from captured string in pattern matching?
by hihilo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |