Thanks for the help guys, I have it working now.

Tom


-----Original Message-----
From: Daniel Gardner [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 3:44 PM
To: Wright Thomas
Cc: Beginners (E-mail)
Subject: Re: system `ls` or File::Find?



Monday, December 03, 2001, 8:14:48 PM, Wright, Thomas wrote:

WT> When I do this in Perl thusly:

WT> $oldfile = `system "ls -1r $oldfile.\*.orig | head -1"`;

you want to use system *or* backticks, not both.

  $oldfile = `ls|head`;

should do the trick

here's something that will do it just in perl. very naive though -
it's going to call stat() about a million times (which is bad)

  $oldfile = (sort { (stat $b)[9] <=> (stat $a)[9] } <*> )[0];

i'd say that if you're happy with the shell way then stick with it -
it's going to make far more sense to you, and whoever has to maintain
the script later.

  
-- 
Best regards,
 Daniel                            mailto:[EMAIL PROTECTED]


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

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

Reply via email to