in reply to Speedy directory searching

The '\' in your regular expression does nothing "twice" because 1) it's invisible because it's not escaped with another '\' and 2) $_ will contain only the filename, not any of the separtors.

Your print can be done with:

print CSV " SERVER01.dbdev1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOS +T=SERVER01)(PORT=1527)))(CONNECT_DATA=(SID=dbDEV1))) SERVER01.dbdev2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOS +T=SERVER01)(PORT=1527)))(CONNECT_DATA=(SID=dbDEV2))) SERVER01.dbintst=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HO +ST=SERVER01)(PORT=1527)))(CONNECT_DATA=(SID=dbINTST))) SERVER01.dbmstr=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOS +T=SERVER01)(PORT=1527)))(CONNECT_DATA=(SID=dbmstr))) ";
Probably. This would deiniftely be OK on *nix, but with the odd newline sequence in Win32, it may not act as expected...

But I really don't know why it's so slow. Maybe you should count how many times wanted() gets called - perhaps you just have a god-waful numbe rof files on your system. --Bob Niederman, http://bob-n.com

Replies are listed 'Best First'.
Re: Re: Speedy directory searching
by waswas-fng (Curate) on Jul 15, 2003 at 05:23 UTC
    it is slower on win98 for many reasons with one of the largest being that fat32 is slow and does not get cached well when walking the dir tree. also use strict, hereto's and don't use & to call a sub (unles you have good reason) for example your wanted sub can look like this:
    sub wanted { /TNSNAMES.ORA/i or return; Details($File::Find::name); }


    -Waswas
      I'm using 2k NTFS locally. The better use of subs took the time from 2mins 30secs to 2mins 10secs which is well worth while (I will remember this so thanks). use strick is confusing and seems only to help my badly written working scripts to not work. I have yet to see an explenation of use strick that makes sense to me (I'll read it again now I have a little better understanding in general so thanks for the reminder). I know I should use it I don't know how or why so I'll RTFM and try to remember ;) Thanks again, the sub stuff is great.
Re: Re: Speedy directory searching
by ironpaw (Novice) on Jul 16, 2003 at 03:51 UTC
    Yes the regular expression has a useless \ (legacy from using bits of other scripts and not cleaning them up). Your Print suggesting is much far better, thanks (I'll remember that). It does work on my Win2000 (perl 5.005_02 built for MSWin32-x86-object). It took about 2mins 30 seconds and the system has 66,150 files in 7,850 directories so I guess that is pretty reasonable (windows takes 2 mins to search for all files and it has the indexing service). My only option would be to limit the places it searches I guess. Thanks