in reply to using split on a file

You can try something like this: LOOP:
while (<INFILE>) { next LOOP if /^%/; #process segment here }
That'll process for any line that doesn't start with a %. Egg, YAPH-and-BOFH-wannabe