On Thu, May 1, 2008 at 11:20 PM, Anderson Ramroop <[EMAIL PROTECTED]> wrote:
>
> I just want to pull the latest data with the Acct number...
>
> not the whole string sorted by date?
>
Please submit the question back to the list.
For this case, codes could be:
use strict;
use Time::Local;
my @arr;
while(<DATA>) {
chomp;
my ($id,$date) = split/\~/;
if (@arr) {
my $time_old = gettime($arr[1]);
my $time_new = gettime($date);
@arr = ($id,$date) if $time_new > $time_old;
} else {
@arr = ($id,$date);
}
}
print "@arr\n";
sub gettime{
my ($m,$d,$y) = split/\//,+shift;
return timelocal(0,0,0,$d,$m -1,$y);
}
__DATA__
155073040~06/04/1998
155073040~04/28/1998
155073040~04/29/1998
255256040~04/29/1998
255293040~05/27/1999
255322040~12/09/1999
55322040~12/08/1999
755379040~04/30/1998
755383040~04/30/1998
755412040~01/19/1999
755612040~04/19/2000
755633040~04/26/1999
755763040~06/04/1998
--
J. Peng - QQMail Operation Team
eMail: [EMAIL PROTECTED] AIM: JeffHua
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/