Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Read from a file and replace

by Rudif (Hermit)
on Aug 18, 2001 at 03:12 UTC ( #105826=note: print w/replies, xml ) Need Help??


in reply to Read from a file and replace

And there is the Slurp module - saves you a couple of lines
#!perl -w use strict; use File::Slurp; my $find = quotemeta("here.company.com/pagedir"); my $replace = "there.company.com/"; my @lines = read_file "file.html"; foreach (@lines) { s/$find/$replace/g; } write_file "newfile.html", @lines;
Rudif

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2023-12-02 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (13 votes). Check out past polls.

    Notices?