Make the key by joining the first 2 fields. see splice and join
pojforeach my $line (@lines) { $line =~ s/^\s+//; my @elements = split /\s+/, $line; my $key = join '-',splice @elements, 0, 2; # 2 col key $hash{$key} = \@elements if length($key) > 0; # no blank keys }
In reply to Re^3: Adding text file data to hashes and array
by poj
in thread Adding text file data to hashes and array
by Tigor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |