Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Clearing lines in a file based on an array containing the lines

by ramrod (Curate)
on Apr 22, 2009 at 20:27 UTC ( #759396=note: print w/replies, xml ) Need Help??


in reply to Clearing lines in a file based on an array containing the lines

You can eliminate the second "grooming" by comparing against your elements at the same time:

print FILE $LINE unless ($array[0] eq "$erasethese[0]" || $array[0] eq + "$erasethese[1]" );
As far as only opening the file once, you can try opening it for both reading and writing (+<)
  • Comment on Re: Clearing lines in a file based on an array containing the lines
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2021-10-20 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (79 votes). Check out past polls.

    Notices?