You can add hashref to %most_recent instead of a scalar ($dtime).
... if ( not defined $most_recent{$col1}{$col2} or $most_recent{$co +l1}{$col2}->{dtime} lt $dtime ) { $most_recent{$col1}{$col2}->{dtime} = $dtime; $most_recent{$col1}{$col2}->{col3} = $col3; $most_recent{$col1}{$col2}->{col4} = $col4; } } print "Most recent:\n"; foreach my $col1 ( keys %most_recent ) { foreach my $col2 ( keys %{$most_recent{$col1}} ) { print "$col1, $col2, $most_recent{$col1}{$col2}->{dtim +e}, $most_recent{$col1}{$col2}->{col3}, $most_recent{$col1}{$col2}->{ +col4}\n"; } }
In reply to Re: perl to Remove duplicates lines from a csv file based on timestamp most recent
by pme
in thread perl to Remove duplicates lines from a csv file based on timestamp most recent
by john.tm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |