Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Problem with String replace in file

by meraxes (Friar)
on Oct 22, 2007 at 17:36 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://646511]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found