in reply to breaking up a file by delimiter

When you undef the input record separator, you will get the whole input file. I don't think that is the best way. Note that the line endings (\n) would be included in this, that's why you need your grep on non-white space.

I am not at a computer where I can test, but is something like this what you want? Untested:

while (my $line = <$input>) { if ($line =~ /^XXX$/) { print "\n"; } else { chomp $line; print $line; } } print "\n"; #may need a final one of these
In general, I prefer to process files line by line instead of creating an in memory copy of the whole thing, but with computer memory what it is nowadays, this doesn't matter so much.