http://qs1969.pair.com?node_id=1077011


in reply to Re^3: header footer
in thread header footer

No, I don't think you're missing a thing, and it may look like:

use strict; use warnings; while (<>) { s/^HDR.{47}|\KFTR.+//; print; }

In fact, it may be faster than substr on the 3GB file, but am not sure. Pattern matching to remove the header seems just fine. However, if FTR exists anywhere else in the record, a substitution will mess up the record--which is something substr will not do.