open (FILE, "<", $ARGV[0]) || die "$!"; $/ ="seperator"; while (){ ## process lines between separators but don't forget that you defined record separator as "separator" !!! } $/ = "\n"; # return the record separator to standard or if it is a stand alone script this is not necessary because you are finished