[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Less is more



This should work...

#! /bin/perl
use Time::gmtime;
use File::stat;

$file="test.txt";
# HERE IS THE ONE LINE
@modtime=split(" ",localtime(stat($file)->mtime)); # print @modtime[3];

Chris

-----Original Message-----
From: omaha-pm-bounces@pm.org [mailto:omaha-pm-bounces@pm.org] On Behalf
Of Jay Hannah
Sent: Thursday, December 22, 2005 12:22 PM
To: Perl Mongers of Omaha, Nebraska USA
Subject: Re: [Omaha.pm] Less is more

Ryan Stille wrote:
> I am was trying to get this done in one line, just for the heck of it.
> I need the modification time of a file referenced by $file ($file
> contains the path and filename of the file).

I don't know how to get that strftime thing working...

my ($y, $m, $d) = (localtime((stat($file))[9]))[5,4,3];
$y += 1900;

?
 
j
_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm


This message and any included attachments are from Nebraska Methodist Health System and its affiliates and are intended only for the addressee. The message may contain privileged, confidential and/or proprietary information intended only for the person(s) named.  Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Nebraska Methodist Health System and its affiliates in Omaha, Nebraska, U.S.A at (402)354-2280.