Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How would I write this multiple substitution script?

by fisher (Priest)
on Oct 13, 2011 at 09:26 UTC ( #931177=note: print w/ replies, xml ) Need Help??


in reply to How would I write this multiple substitution script?

Why don't you test it on a test directories with test files?

Yes, you headed in a right direction. In the first directory you rename files and in the second you substitute contents of a files.

well, hint.

foreach $filename (@files) { open FILEIN, "<", $filename; open FILEOUT, ">", $filename."new"; while (my $data = <FILEIN>) { $data =~ s/red/blue/g; print FILEOUT $data; } close FILEIN; close FILEOUT; }
...and then rename.


Comment on Re: How would I write this multiple substitution script?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2015-07-08 05:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls