Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: read and write to same file

by aukjan (Friar)
on Aug 19, 2005 at 10:59 UTC ( [id://485060]=note: print w/replies, xml ) Need Help??


in reply to read and write to same file


If you know that each line has a ',' you can also use chop instead of the RE

Go Fish!

Replies are listed 'Best First'.
Re^2: read and write to same file
by Nkuvu (Priest) on Aug 19, 2005 at 17:37 UTC
    Unless I'm missing something, chop will take of the end of line character first, based on $/. So you'd have to chomp (to safely remove the possibly non-existent end of line character) then chop. Then put the end of line character back on, assuming there was one to begin with. Or chop once, check to see if it was an eol character, and chop again for the comma and tack the eol character back on.

    So. Am I missing something obvious here?

      this posting was absolutely well-formed and correct, but nobody posted a question matching to my answer, so I removed it... it was too early in the morning...

      Please, dear NodeReaper, would you mind removing my posting

      Best regards,
      perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found