use strict; use warnings; my $tr="" . ("(.*?)"x8) . ""; while () { my @x = m/\G$tr/cgo or next; print join("|", @x), "\n"; } __DATA__ IamSantaClauseIamSantaClause Blah Blah This Will Not Match IamEasterBunnyIamEasterBunny NeitherWillThis