BTW: Another way to determine the start/middle/end position of a matched substring in a string is by using the @- @+ regex special variables; see perlvar.
Play with adding '-'s at the start/end of $s to convince yourself this works.c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'foo--bar--baz'; ;; while ($s =~ m{ (\w+) }xmsg) { printf qq{matched '$1' %s of '$s' \n}, $-[1] == 0 ? 'at start' : $+[1] == length $s ? 'at very end' : 'in middle'; } " matched 'foo' at start of 'foo--bar--baz' matched 'bar' in middle of 'foo--bar--baz' matched 'baz' at very end of 'foo--bar--baz'
Give a man a fish: <%-{-{-{-<
In reply to Re^5: perl indication of end of string already matched
by AnomalousMonk
in thread perl indication of end of string already matched
by nachumk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |