develooper Front page | perl.beginners | Postings from January 2002

comparing dates

Thread Next
Alex Harris
January 7, 2002 08:39
comparing dates
Message ID:

if I use the following to get the date of a file:
    use File::stat;
    use Time::localtime;
    $date_string = ctime(stat($file)->mtime);
    print "file $file updated at $date_string\n";

I get:
   Mon Jan  7 10:21:21 2002

Now I want to compare another file date to this one getting the date the 
same way but I don't understand the following example:

    sub getdate {
	local($_) = shift;
	s/-(\d{4})$/+$1/ || s/\+(\d{4})$/-$1/;
	    # getdate has broken timezone sign reversal!
	$_ = `/usr/local/lib/news/newsbin/getdate '$_'`;

I can't use c modules because they haven't been added and I don't have 
permissions.  TIA

Send and receive Hotmail on your mobile device:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About