in reply to Re^2: How can one create an array of the indices at which a given character appears in a string?
in thread How can one create an array of the indices at which a given character appears in a string?
Maybe I misunderstood perlvar and it doesn't work with /g in list context but only with repeated match groups in a non-global match.
Anyway you should take @- for start, your results show the ends.
Can't test ATM...sorry.
print $-[0] while /n/g
now tested:
DB<100> $_ = " x " x 3 => " x x x " DB<101> print $-[0] while /x/g 147
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How can one create an array of the indices at which a given character appears in a string?
by Not_a_Number (Prior) on Jan 29, 2015 at 14:42 UTC | |
by LanX (Saint) on Jan 29, 2015 at 14:50 UTC | |
by DanBev (Scribe) on Jan 29, 2015 at 14:54 UTC |