Movatterモバイル変換


[0]ホーム

URL:


variables /@-
(source,CPAN)
You are viewing the version of this documentation from Perl 5.8.2.View the latest version
#@LAST_MATCH_START
#@-

$-[0] is the offset of the start of the last successful match.$-[n] is the offset of the start of the substring matched byn-th subpattern, or undef if the subpattern did not match.

Thus after a match against $_, $& coincides withsubstr $_, $-[0], $+[0] - $-[0]. Similarly,$n coincides withsubstr $_, $-[n], $+[n] - $-[n] if$-[n] is defined, and $+ coincides withsubstr $_, $-[$#-], $+[$#-]. One can use$#- to find the last matched subgroup in the last successful match. Contrast with$#+, the number of subgroups in the regular expression. Compare with@+.

This array holds the offsets of the beginnings of the last successful submatches in the currently active dynamic scope.$-[0] is the offset into the string of the beginning of the entire match. Thenth element of this array holds the offset of thenth submatch, so$-[1] is the offset where $1 begins,$-[2] the offset where $2 begins, and so on.

After a match against some variable $var:

#$` is the same assubstr($var, 0, $-[0])
#$& is the same assubstr($var, $-[0], $+[0] - $-[0])
#$' is the same assubstr($var, $+[0])
#$1 is the same assubstr($var, $-[1], $+[1] - $-[1])
#$2 is the same assubstr($var, $-[2], $+[2] - $-[2])
#$3 is the same assubstr $var, $-[3], $+[3] - $-[3])

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2025 Movatter.jp