Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
filenames as 508.ids.xml 1508.ids.xml 1509.id123.xml 1400.id123.xml
#!/usr/bin/perl use XML::Simple; use ContentHelper; use XML::Parser; @files = `ls`; # Sub substitution to check for duplicates foreach $input_file (@grepNames){ chomp $input_file; my $xml_parser = XML::Simple->new(); my $data = $xml_parser->XMLin($input_file); my $Id = $data->{"root"}->{'id'}; my $date = $data->{'root'}->{'date'}; my $time = $data->{'root'}->{'time'}; ### Please tell me how to add the condition here. print "$input_file:$Id:$time:$date\n\n"; }
Here how to delete the files, 9890.ids.xml:ids:70857:2004-10-02 and 9834.ids.xml:ids:4000:2004-10-02 as it has the less date and timeThe above print command prints 9890.ids.xml:ids:70857:2004-10-02 9893.ids.xml:ids:70859:2004-10-02 9830.ids.xml:ids:2000:2004-10-02 9834.ids.xml:ids:4000:2004-10-01
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Delete the file with checking the value
by almut (Canon) on Feb 26, 2010 at 20:20 UTC | |
by Anonymous Monk on Feb 28, 2010 at 05:40 UTC | |
by almut (Canon) on Feb 28, 2010 at 09:45 UTC | |
|
Re: Delete the file with checking the value
by ack (Deacon) on Mar 01, 2010 at 21:10 UTC |