in reply to check for date and time

I assume you mean that you have to print the latest time for each date.
Why not put the dates in a hash with the time as a value.
When you get an already defined hash key you can check to see if the time is later and update it.
Then, print out you list of hash and keys with whatever formatting you want.

Replies are listed 'Best First'.
Re^2: check for date and time
by Anonymous Monk on Feb 26, 2010 at 05:33 UTC
    How to create a hash of id as key, value with the latest date and time.
      try something like;
      #!/usr/bin/perl -w use strict; my %idhash; my @ids; foreach (@id_list){ #split up your input line into something useful @ids = split (/-->/,$_); # check to see if that date is already in your hash and if it is ne +wer if(defined($idhash{$ids[1]}) && $idhash{$ids[1]} >= $ids[2]){ next }else{ #populate your hash $idhash{$ids[1]} = $ids[2]; } } #then print your dates from the hash using foreach key
        #!/usr/bin/perl use XML::Simple; @files = `ls`; use XML::Parser; foreach $input_file (@files){ my $xml_parser = XML::Simple->new(); my $data = $xml_parser->XMLin($input_file); my $date = $data->{'root'}->{'date'}; my $time = $data->{'root'}->{'time'}; }
        How to store only one date file which has large date and time