in reply to Re^2: Matching next line in text file
in thread Matching next line in text file
I made $stn a hash ref because this isn't going to work:
You'll find that the header will always point to the same array. The same will be true for stations - all of them will be the same hash.$seg{$lname} = { 'header' => \@hdr, 'stations' => \%stn, };
However, if you make the stn hash a hash ref, then this will work:
Note the square brackets around @hdr - this will create a new array.# time to save stn and headers: $seg{$lname} = { header => [ @hdr ], stations => $stn }; @hdr = () $stn = undef;
|
|---|