#!/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
In reply to Re: String print
by Utilitarian
in thread String print
by tally123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |