in reply to Re: Lost hash values
in thread Lost hash values

My previous replies were hidden. One has to click on the 2nd "reply4" in this thread and then reply7 to see the fix: BTW, I am new to this posting, how to aviod this? Anyway, here is the final script:
#!/usr/bin/perl -w open FILE1,"out.prod1" or die "Cannot open file $!"; @rec=<FILE1>; $first=undef; %save=(); foreach $x (@rec){ chomp $x; if ( $x =~ /2005/ ){ $first=$x; if(!defined $save{$first}){ $save{$first}=undef;} } if ( $x =~ /time/ ){ $lat=$x; $lat =~ s/.*?time=(\d+)\.\sms$/$1/; if( $lat > "10" ){ $save{$first}=$lat; } } } foreach $first (sort keys %save){ if ($save{$first}){ print "$first $save{$first}\n"; } }