Perldoc Search: "$-" perl-5.20.1

search official POD


6 PODs, 25 LINEs found.
perlvar.pod
413 :             substr($str, 0,     $-[0]),
414 :             substr($str, $-[0], $+[0]-$-[0]),
549 :     @-      $-[0] is the offset of the start of the last successful match. "$-["*n*"]" is the offset of the start of the substring matched by *n*-th subpattern, or undef if the subpattern did not match.
551 :             Thus, after a match against $_, $& coincides with "substr $_, $-[0], $+[0] - $-[0]". Similarly, $*n* coincides with "substr $_, $-[n], $+[n] - $-[n]" if $-[n] is defined, and $+ coincides with "substr $_, $-[$#-], $+[$#-] - $-[$#-]". 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 "@+".
553 :             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. The *n*th element of this array holds the offset of the *n*th submatch, so $-[1] is the offset where $1 begins, $-[2] the offset where $2 begins, and so on.
557 :             $` is the same as "substr($var, 0, $-[0])"
558 :             $& is the same as "substr($var, $-[0], $+[0] - $-[0])"
560 :             $1 is the same as "substr($var, $-[1], $+[1] - $-[1])"
561 :             $2 is the same as "substr($var, $-[2], $+[2] - $-[2])"
562 :             $3 is the same as "substr($var, $-[3], $+[3] - $-[3])"
573 :                         my $ary = $-{$bufname};
575 :                             print "\$-{$bufname}[$idx] : ",
586 :                 $-{A}[0] : '1'
587 :                 $-{A}[1] : '3'
588 :                 $-{B}[0] : '2'
589 :                 $-{B}[1] : '4'
789 :     $-      The number of lines left on the page of the currently selected output channel.
perlretut.pod
470 :     In addition to what was matched, Perl also provides the positions of what was matched as contents of the "@-" and "@+" arrays. $-[0] is the position of the start of the entire match and $+[0] is the position of the end. Similarly, $-[n] is the position of the start of the $n match and $+[n] is the position of the end. If $n is undefined, so are $-[n] and $+[n]. Then this code
475 :             print "Match $exp: '${$exp}' at position ($-[$exp],$+[$exp])\n";
493 :         $` is the same as substr( $x, 0, $-[0] )
494 :         $& is the same as substr( $x, $-[0], $+[0]-$-[0] )
perlreref.pod
255 :        @-    Offsets of starts of groups. $-[0] holds start of whole match
perlfunc.pod
4886 :         Top of form processing is handled automatically: if there is insufficient room on the current page for the formatted record, the page is advanced by writing a form feed and a special top-of-page format is used to format the new page header before the record is written. By default, the top-of-page format is the name of the filehandle with "_TOP" appended, or "top" in the current package if the former does not exist. This would be a problem with autovivified filehandles, but it may be dynamically set to the format of your choice by assigning the name to the $^ variable while that filehandle is selected. The number of lines remaining on the current page is in variable $-, which can be set to 0 to force a new page.
perlform.pod
143 :     It is possible to intermix print()s with write()s on the same output channel, but you'll have to handle $- ($FORMAT_LINES_LEFT) yourself.
perlperf.pod
103 :         my $STR = "$$-this and that";
<< Back to Perldoc Search