Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Problem with String replace in file

by meraxes (Friar)
on Oct 22, 2007 at 17:36 UTC ( #646511=note: print w/replies, xml ) Need Help??


in reply to Re^2: Problem with String replace in file
in thread Problem with String replace in file

I suspect your problem is that you are writing back to the filehandle IN when you (presumably) only opened it for read.

open( IN, '<', $filename ); # input open( OUT, '>', 'newfilename.txt' ); # output while ( <IN> ) { s/\|\|/|\\N|/g; print OUT; } close IN; close OUT;
--
meraxes

Replies are listed 'Best First'.
Re^4: Problem with String replace in file
by philosophia (Sexton) on Oct 22, 2007 at 18:17 UTC
    This was correct, thank you. || is replaced by |\N| throughtout newfilename.txt.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://646511]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2016-12-11 14:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (169 votes). Check out past polls.