Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Editing Contents of a File

by ColtsFoot (Chaplain)
on Jun 21, 2004 at 13:54 UTC ( [id://368439]=note: print w/replies, xml ) Need Help??


in reply to Editing Contents of a File

You don't appear to be writiing anything to the output file.
May I suggest the following
#!/usr/bin/perl -w use strict; open INPUT, 'your_input_fiel.txt'; open OUTPUT '>your_output_file.txt'; while (my $line = <INPUT>) { chomp $line; $line =~ s/hello/goodbye/gi' print <OUTPUT> $line; } close INPUT; close OUTPUT;
Hope this helps

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2024-04-23 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found