in reply to breaking up a file by delimiter
I am not at a computer where I can test, but is something like this what you want? Untested:
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.while (my $line = <$input>) { if ($line =~ /^XXX$/) { print "\n"; } else { chomp $line; print $line; } } print "\n"; #may need a final one of these
|
|---|