Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Please advise why the below script works for me on my local NT workstation and on my Unix server but does not work on our NT server. It doesnt give any results. There are results but for some reason it wont fetch anything on the NT server. It just gives an output of "Total Count = 0". Why wont it fetch data? Do I need to change something to get this to work on the NT server?
use File::Find; $ct = 0; sub fetcher { if( $_ =~ /\.html?$/) { my $name = $File::Find::name; open ( F, $name ) or die "$!: $name\n"; while( $line = <F> ) { for $i ($line =~ /\@(?:ff|jj|bb)/g) { print "$i\n"; $ct++; } } close F; } } find( \&fetcher, 'C:\\inetpub\\wwwroot' ) || warn "$!\n"; print "\n\nTotal Count = $ct\n\n";

Replies are listed 'Best First'.
Re: NT Server script (nlink?)
by tye (Sage) on Jun 25, 2003 at 19:35 UTC

    Well, File::Find has often not worked for me because of an irrational "optimization" (that actually makes many things slower). Try adding:

    $File::Find::dont_use_nlink = 1;
    right below the use File::Find line and see if that helps. If it does help, then upgrading File::Find on the NT server might also be a fix for the problem.

                    - tye
      Thanks I will give that a try. File::Find has worked for me in the past on this server so I assumed it was okay.
        I just found out we had an old Perl version on the server! That was the problem. Sorry for not finding this out before I posted this question!
Re: NT Server script
by particle (Vicar) on Jun 25, 2003 at 19:15 UTC

    it's hard to say. but the path here is hard-coded, are you sure it's correct? does it work if you map a drive from your workstation to the nt server and modify the path info?

    ~Particle *accelerates*

      Its being run by the system admins on the actual server and Iam sure it is correct because I have used it before.
      Any other suggestions??
      Thanks.