If you are starting the script each time, the -M will work, but if
it is something that is always up and running(maybe not initially, but if
you are working towards that) then -M will not give you what you expect.
The -M goes in relation to the startup of the script.

        Just a FYI because it has bitten me from an earlier script.

Wags ;)

-----Original Message-----
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 10:00
To: [EMAIL PROTECTED]
Subject: Re: `ls -ltr`


Mayank Ahuja wrote:
> 
> Hi all,

Hello,

> Please help me out with my beginners question:
> 
> Is there a way I can code an equivalent of `ls -ltr | tail -5` [on UNIX]
> in perl ?

If you just want a list of the five newest files then:

my @files = ( sort { -M $a <=> -M $b } <*> )[ 0 .. 4 ];



John
-- 
use Perl;
program
fulfillment

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


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************


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

Reply via email to