in reply to how to avoid opening and closing files

Can I just open once a file and remove all lines together having words stored in words.txt

Also see Re: Search Replace String Not Working on text file. You can open a file just once, then truncate and rewrite it. Of course this requires you save your output temporarily in an array. For a 60 mb file, you might want to use @ARGV's special line-by-line in-place editing capability, as also shown in the link. That would save you creating a big array.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: how to avoid opening and closing files