in reply to finding the position of a particular character in a string
perl -E' $a="THE FOOD IS DELICIOUS"; $srch="O"; push @i,index($a,$srch,$i[-1]+1) for $a=~/$srch/g; $" = ","; say "@i"; ' 5,6,18
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding the position of a particular character in a string
by BrowserUk (Patriarch) on Oct 06, 2011 at 04:45 UTC |