----- Original Message ----- From: "Tillman, James" <[EMAIL PROTECTED]> To: "'Conrad, Ben'" <[EMAIL PROTECTED]>; "Perl-Win32-Users" <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 11:58 Subject: RE: Globbing speed
> Sure: > > * Don't use fileglobs, and open a dirhandle instead. You'll get results as > soon as you process the first file. > * Use cygwin and run ActiveState perl while in bash. cmd.exe is retarded > in many respects, one of which is file-globbing. Perl is having to make up > for its limitations by itself, which causes the delay. > > Hope this helps. > > jpt > > > -----Original Message----- > > From: Conrad, Ben [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, January 22, 2003 11:59 AM > > To: Perl-Win32-Users > > Subject: Globbing speed > > > > > > Folks, > > > > I'm do a lot of opening up of directories and operating on > > all files in that directory. Is there a faster way to > > populate handles than: > > > > while ($filename = <$source/*>) { > > ... > > } > > > > On large directories this takes several minutes before -any- > > of the code in the while() loop is executed. In the most > > recent example my directory has 14,000+ files. "dir" from > > cmd.exe is really fast and so is Windows Explorer, they both > > give me all the attributes of the files too! > > > > Is there a better, faster, Perlish way to glob a directory? Ben, If you are strictly operating on Win32, the dir command is faster than any pure Perl solution: my $src = 'c:\perl\scripts\\'; my @list = `dir /b/s \"$src\"`; Dirk Bremer - Systems Programmer II - ESS/AMS - NISC St. Peters USA Central Time Zone 636-922-9158 ext. 8652 fax 636-447-4471 [EMAIL PROTECTED] www.nisc.cc _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs