Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Replacing a character in a file

by Laurent_R (Canon)
on Jan 03, 2018 at 20:31 UTC ( #1206631=note: print w/replies, xml ) Need Help??

in reply to Replacing a character in a file

If you really want to get rid of some characters in your data (and I agree with 1nickt++ that perhaps you shouldn't), then it would probably be better to store the result of your query into an array in memory, modify the array to clean it up and then only write the data to a file, rather than writing immediately to a file and then trying to change the file.

Also, it seems that your code is opening the Plants.txt file in write mode, this will clutter the existing file, probably not what you want.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2018-06-23 06:51 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.