in reply to Pulling out oldest entries from a text file

You don't need a date function to determine the oldest date. Your dates are formatted so that string comparison works. Here is a way to extract the oldest entry for each group:
use List::Util qw( maxstr); my %tb; while ( <DATA> ) { my ( undef, $group, $entry_date) = split; $tb{ $group}->{ $entry_date} = $_; } print $_->{ maxstr keys %$_} for values %tb; __DATA__ 34 gr1 2003-03-02 12 gr1 1990-03-14 39 gr3 2002-04-11 66 gr4 2006-03-16 32 gr3 1998-02-13 90 gr1 2004-06-15 55 gr4 1999-06-15
Update: Code cleaned up

Anno