Given your example, what you want is a hash of arrays of hashes:
my %data;
push @{$data{$linename}}, { station => $station, coords => $coords, ea
+sting => $easting, northing => $northing, elevation => $elevation };
for my $linename ( keys %data ){
for my $entry ( @{$data{$linename}} ){
print "$linename: @{$entry}{qw(station easting northing elevation)
+};
}
}
At least, that's what it looks like from your example, but you really haven't given enough information about the structure of those fields.