PRyanRay has asked for the wisdom of the Perl Monks concerning the following question:
I want to be able to compare so I know which input file is earlier, something like:$string1 = "2008/11/22 01:40:00.000"; $string2 = "2008/11/22 01:45:00.000";
But this is not consistent and does not always work. Is there a better way to compare and execute code once I know which file is earlier? Thanks in advance, I'm a newbie!if($string1 eq $string2){$early = $ARGV[0]; $late = $ARGV[1];} if($string1 lt $string2){$early = $ARGV[0]; $late = $ARGV[1];} if($string1 gt $string2){$early = $ARGV[1]; $late = $ARGV[0];}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time matching YYYY-MM-DD HH:MM:SS.SSS
by aitap (Curate) on Jul 26, 2012 at 17:55 UTC | |
|
Re: Time matching YYYY-MM-DD HH:MM:SS.SSS
by dave_the_m (Monsignor) on Jul 26, 2012 at 18:27 UTC | |
by PRyanRay (Novice) on Jul 26, 2012 at 18:38 UTC | |
by dave_the_m (Monsignor) on Jul 26, 2012 at 19:03 UTC | |
by PRyanRay (Novice) on Jul 26, 2012 at 19:19 UTC | |
by dave_the_m (Monsignor) on Jul 26, 2012 at 19:44 UTC | |
| |
|
Re: Time matching YYYY-MM-DD HH:MM:SS.SSS
by Bloodnok (Vicar) on Jul 27, 2012 at 12:34 UTC |