The stupid question is the question not asked | |
PerlMonks |
Regex and @+by claree0 (Hermit) |
on Aug 31, 2001 at 15:13 UTC ( [id://109351]=perlquestion: print w/replies, xml ) | Need Help?? |
claree0 has asked for the wisdom of the Perl Monks concerning the following question: I've been working through Japhy's regular expression draft and I'm confused by the operation of the @+ array. Rather than keep bugging Japhy, I thought I'd ask here! The exercise from Chapter 3 asks for the contents fo the @- and @+ arrays after matching /(\w+)\W+(.*)/ on "where are you". I would expect the contents to be [0, 0, 6] and [14, 5, 14] respectively, but instead the code
gives the result
Why does $+[2] contain 6 rather than 14?
Back to
Seekers of Perl Wisdom
|
|