• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replacing text in a file using perl script

 
Patricia Samuel
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to replace some value in config file using perl script. I used this code -


When i print $file , it shows me the changed rows but it does not write it to a file. Please suggest.

Regards,
Patricia samuel
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since your are reading the whole file into memory you can safely re-open the file and write to it i.e.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic