in reply to Re^2: position of first matching regex
in thread position of first matching regex
... $-[0] requires /...(...).../ re positional variables.
You show a capturing group in your example and refer to "positional variables", so I thought I'd mention that $-[0] is the offset of the start of the overall match and does not depend at all on capture groups.
c:\@Work\Perl>perl -wMstrict -le "my $s = 'xxxabcyyy'; ;; print qq{overall match begining at offset $-[0] in '$s'} if $s =~ m{ abc }xms; " overall match begining at offset 3 in 'xxxabcyyy'
(And BTW: I've been practicing goofs for quite a while myself.)
|
|---|