You can use pos() in combination with m//g ...
while ( $txt =~ /$srch/g ) { push @offset, pos($txt) - 1; }
... or as one-liners ...
push @offset, pos($txt) - 1 while $txt =~ /$srch/g; # while ( $txt =~ /$srch/g ) { push @offset, pos($txt) - 1 }
--k.
In reply to Re: 'Trying! to get! index functionality! in array context!?'
by Kanji
in thread Trying to get index functionality in array context
by guha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |