writing in an existing file in perl?

  • akaash
  • Beginner
  • Beginner
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

how can i write in an existing file but not appending.

i want to substitute a word in a file with other word how can i do that?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • bob9999
  • Newbie
  • Newbie
  • bob9999
  • Posts: 11

Post 3+ Months Ago

Open the file for read/write.
Read all the text into a variable
Do a search & replace in the variable for the word you want to change.
Write the variable back to the file.
Close the file.

I hope this helps,

Bob
  • akaash
  • Beginner
  • Beginner
  • akaash
  • Posts: 62
  • Loc: Gujurat,India

Post 3+ Months Ago

ya but
how to open file for read + write mode in perl?

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 148 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.