in reply to Removing the first record in a file containing fixed records
I decided to go with a loop reading the entire file and outputting each record (except the first) to a separate output file. It turns out that I needed to do some record by record validation anyway so this makes the most sense. I'd just print OUTPUTFILE ($record) after the validation checks out for that record.
I just want to make a quick comment about Tie::File. In my experience it's very nice and easy to use for smaller files but once you get to even medium sized files the performance will suffer. I had a program using Tie::File which ran for over 15 minutes and switching over to the traditional open/read/write cut down the time to a few seconds! It does have it's uses though and I use it for other things that aren't as intensive.
I like the suggestions (like in place writing and swapping the header with the last record) and I think I'll be able to use them in some of the other stuff I'm working on soon.
Thanks again everyone!
|
|---|