Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Have you actually walked through the logic of when files are being opened and closed? It doesn't make any sense to me to open a file for append mode on line 16, try to read from that file on line 17, print to it on line 21, close it on line 22, open it again on line 25, print to it on line 27, close it on line 29, and then try to print to a closed filehandle on the next iteration of the loop on line 21 again. I think once you sort that out you'll be better off. For the sort of thing you're trying to do, slurping into an array and running grep on it repeatedly in a loop isn't really "how it's done". Your situation may be a little more complicated than this, but here's the general algorithm:
Also, place use autodie; toward the top of your script, near the use strict;, so that you can get some basic sanity checking on your file operations. Dave In reply to Re^3: Using grep to pick out Specific lines in a text file
by davido
|
|