c:\@Work\Perl>perl -wMstrict -le "use 5.010; ;; my $s = qq{xxx \@B grab \n this \@E yy zzzz \@B and \n this \n too \@E qq}; print qq{[[$s]]}; ;; my $start = qr{ \@B }xms; my $stop = qr{ \@E }xms; ;; my $replace = [ 'ZOT', 'ZONK' ]; ;; my $i = 0; $s =~ s{ $start \K .*? (?= $stop) } { $replace->[ $i++ % @$replace ] }xmsg; print qq{<<$s>>}; " [[xxx @B grab this @E yy zzzz @B and this too @E qq]] <>