Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: positions of all occurrences of a substring in a string

by InfiniteSilence (Curate)
on Jun 20, 2014 at 13:35 UTC ( #1090632=note: print w/replies, xml ) Need Help??


in reply to positions of all occurrences of a substring in a string

Read perldoc perlvar. pos gives you the last position of the match. Instead:

perl -e '$str = q|aaabbbcccddd|; while($str=~m/(\S)\1\1/g){print @-[0] +};' 0369

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2022-01-19 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?