c:\@Work\Perl\monks>perl -wMstrict -le "my $s = qq{foo match \n the first bar second \n match baz}; print qq{[[$s]] \n}; ;; if ($s =~ m{ (.*?) }xmsg) { print qq{if: '$1'}; } print ''; ;; pos $s = 0; while ($s =~ m{ (.*?) }xmsg) { print qq{while: '$1'}; } " [[foo match the first bar second match baz]] if: ' match the first ' while: ' match the first ' while: ' second match '