Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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


Comment on Re^3: Problem with String replace in file
Select or Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2015-07-30 08:25 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 (270 votes), past polls