On Wed, 27 Nov 2002, Mayank Ahuja wrote: > Hi all, > > 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 ?
Yes, there is If you don't want to store the output in your script system ('ls -ltr | tail -5'); Make sure you check $? If you want the output inside your perl script my @files = `ls -ltr | tail -5`; Check $? here too You can use open open (FILELIST, 'ls -ltr | tail -5 |') or die "Failed to exec: $!\n"; while (<FILELIST>) { # Your code } close (FILELIST); perldoc -f open If you want pure perl code perldoc -f glob perldoc File::Glob perldoc -f -x perldoc -f sort -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]