On Fri, 21 Mar 2003, NYIMI Jose (BMB) wrote:

> > -----Original Message-----
> > From: Palmer Greg [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, March 20, 2003 4:50 PM
> > To: NYIMI Jose (BMB)
> > Subject: RE: Unix ls -lrt | tail -1 in Perl
> > 
> > 
> > $filename = `ls -ltr|tail -1 $DIRECTORY`;
> > print $filename;
> 
> Sorry, i didn't mentioned that i wanted a pure perl solution, thanks anyway.
> 
> my $latest = (sort {-M $a <=> -M $b} <$dir/*>)[0];
> Will be my way to go, thanks Sudarshan Raghavan
> 
> José.

The above solution will work but a more time effecient way will be to use 
the Schwartzian transform as explained by Rob Hanson in his mail. Thanks 
Rob :-)

The solution using while that I posted is also more time effecient than my 
sort solution :-)

hth



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to