in reply to Re^2: shorter 1 liner way of doing this
in thread shorter 1 liner way of doing this

> clearly not working :D

combining map and for gives two nested loops.

maybe you meant this?

DB<102> my $i=0; @m= map { $_=~/xxx/ ? $i++ : () } @a => (0, 1, 2)

UPDATE
DB<104> my $i=-1; @m= map { $i++; $_=~/xxx/ ? $i :() } @a => (1, 4, 6)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!