Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: character location question

by RazorbladeBidet (Friar)
on Mar 11, 2005 at 15:36 UTC ( [id://438682]=note: print w/replies, xml ) Need Help??


in reply to character location question

Try LAST_MATCH_END when using a regular expression.

Update:

Regex's are really unnecessary for this on second thought.

How about:
my $i = 0; while ( $i != -1 ) { $i = index( $text, "ll", $i ); if ( $i != -1 ) { print $i, "\n"; $i = $i + 1; } }
or (equivalently)
my $i = 0; print $i++, "\n" while ( ( $i = index( $text, "ll", $i )) != -1 );
--------------
It's sad that a family can be torn apart by such a such a simple thing as a pack of wild dogs

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-28 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found