Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: $+ versus $^N

by Zaxo (Archbishop)
on Apr 16, 2003 at 05:41 UTC ( [id://250792]=note: print w/replies, xml ) Need Help??


in reply to $+ versus $^N

The difference is that $^N contains the last closed capture while $+ contains the last opened one. That is, $^N looks to right parens and $+ to left ones. That makes a difference for nested captures.

From the command line in 5.8.0:

$ perl -e'$_=foobar;/(oo(ba)r)/;print $+,$/' ba $ perl -e'$_=foobar;/(oo(ba)r)/;print $^N,$/' oobar $

After Compline,
Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250792]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-26 07:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found