note
hdb
<p>
As a small variant, there could also be a hybrid case where you want to split on "---" if they are on a line by themselves but not if they occur within a line. Adapting Peter's code:
</p>
<code>
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $line;
{
local $/ = undef;
$line=<DATA>;
}
chomp $line;
my @f = split('\n---\n',$line);
print Dumper(\@f);
__END__
line1
---
line2---line2a
---
line3
</code>
1033972
1033974