Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.

perldoc perlvar


Trying to understand what's going on, I ran the code from the book, but

$-[1] and $+[1] shoudln't match only the first match? (in this case,
shoudln't it be, 7 to 8 ?, instead of 7 to 9 ?)

The length of the first match is 2. 8 - 7 = 1. If $+[1] had the value 8 then the first match would only have a length of 1.

Look at the @LAST_MATCH_START entry in:

perldoc perlvar


Also read the entries for $<digits>, $MATCH, $PREMATCH, $POSTMATCH, $LAST_PAREN_MATCH, $^N, @LAST_MATCH_END and $LAST_REGEXP_CODE_RESULT.

And of course the regular expression documentation:

perldoc perlrequick
perldoc perlretut
perldoc perlre
perldoc perlop



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to