On Fri, Apr 16, 2004 at 02:47:05PM +0100, Rob Dixon wrote:
> You're quite right: I imagined you had written ".. but I only get the first 10 
> files.."
> 
> I always discourage backticks or 'system' calls, but this seems to be a
> good place for it to avoid writing several lines of Perl. Try this:
> 
>   my $loc_src_dir = "g:\\inputdir\\";
>   my @files = (qx(dir $loc_src_dir*.txt /b /o-d))[0..9];
>   chomp @files;
> 

How about: (10 oldest files)

my @files = (sort { (stat $a)[10] <=> (stat $b)[10] } glob "*.txt")[0..9];

-Dave
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to