output should be 146@array = qw("this" "xxx" "is" not "xxx" and "xxx" "whatever"); #exampl +e array @m; $i=0; for(@array){ push(@m,$i)if $_=~/xxx/g; $i++; } print @m;
In reply to shorter 1 liner way of doing this by theleftright
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |