Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Super Find critic needed

by Skeeve (Vicar)
on Jun 30, 2003 at 12:41 UTC ( #270145=note: print w/ replies, xml ) Need Help??

in reply to Super Find critic needed

This comes to my mind:

  1. Why don't you do the replacements in NameReplace instead of pushing all filenames to a global array?
  2. I'd use
    in favour of your 3 replacements.
I don't know whether or not this will be more efficient (untested, incomplete code):
sub NameReplace { if( $_ =~ /\.(?:html?|cfm|cfml|cgi|js|pl)$/) { my $name = $File::Find::name; open ( F, $name ) || warn "$!: $name\n"; $data=join '',<F>; close (F); if ($data=~ s/\bservername(?:\.aa\.company(?:\.zzzz)?\.com)? +\b/NEWNAME.\com/gi) { if (open (F, ">$name")) { print F,$data; close(F); } else { warn "..." } } } }

Comment on Re: Super Find critic needed
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://270145]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2016-02-13 22:27 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (449 votes), past polls