# Skip header junk while(<>) { last if /end of header junk/; } # Start processing real data while(<>) { # But quit if we see junk starting up again last if /start of trailer junk/; # Do useful stuff here }