Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by Anonymous Monk
on Jun 17, 2024 at 17:10 UTC ( [id://11160033]=note: print w/replies, xml ) Need Help??


in reply to Re^3: positions of all occurrences of a substring in a string
in thread positions of all occurrences of a substring in a string

retrieve the positions of all occurences...
Let me tell you something. Somethingsomething smells l 12345678901234567
16 != 17. Don't bump a decades old post with a wrong answer.

Replies are listed 'Best First'.
Re^5: positions of all occurrences of a substring in a string
by choroba (Cardinal) on Jun 18, 2024 at 06:30 UTC
    All the other replies give the same answer. The first character is at position 0, not 1.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^5: positions of all occurrences of a substring in a string
by harangzsolt33 (Chaplain) on Jun 20, 2024 at 04:36 UTC
    First of all, I did not bump it up. You did. Or whoever "Anonymous Monk" is. I don't know who that is. It could be different people. Anonymous Monk replied to this decade old post on June 12. My post is dated June 13.

    Secondly, I did not give a wrong answer, because 16 is the correct answer. But if you think that 17 is the correct answer, then you just insert a "+1" into the code, and viola! it gives you the right answer. LOL :D

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-09-17 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (22 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.