Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Elegant (i.e. declarative) way to find all possibly overlapping matches

by flounder99 (Friar)
on Sep 18, 2003 at 19:54 UTC ( #292505=note: print w/replies, xml ) Need Help??


in reply to Elegant (i.e. declarative) way to find all possibly overlapping matches

Why bother with the while loop?
my $str= "aaa aa aaa"; print "String = '$str'\n"; () = $str =~ /(?=aa)(?{print pos($str),"\n"})./g; __END__ String = 'aaa aa aaa' 0 1 4 7 8

--

flounder

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2020-01-21 14:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?