in reply to Re: Finding the positions of a character in a string
in thread Finding the positions of a character in a string
And using s///.
Ewww.
print pos($str)-1 while $str =~ /\n/g; print $-[0] while $str =~ /\n/g;
Update: Oops, need to subtract 1 from pos() or use $-[0] as you did in the s/// version.
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Finding the positions of a character in a string
by demerphq (Chancellor) on Nov 28, 2005 at 16:22 UTC |