If I understand you correctly something based on the following should resolve your issue
#!/usr/bin/perl -w
use strict;
use warnings;
my $strings =
">fruit
Oranges are not the only fruit
Jeanette Winterson
1985
>dreams
Canal dreams
Iain Banks
1989
";
$strings=~s/>.+\n/|/g;
$strings=substr($strings,1,);
$strings="(:?$strings)";
my $data;
{
local $/=undef;
$data=<DATA>;
}
my @matches = $data=~m/$strings/g;
print join("****\n",@matches);
__DATA__
Oranges are not the only fruit
Jeanette Winterson
1985
Equal Rites
Terry Pratchett
1987
Canal dreams
Iain Banks
1989
Small Wonder
Barbara Kingsolver
1995
American gods
Neil Gaiman
2001
__END__
Oranges are not the only fruit
Jeanette Winterson
1985
****
Canal dreams
Iain Banks
1989
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
|