[Charlotte.PM] find index of array element

diona kidd diona at studio12a.com
Tue Mar 22 08:08:46 PST 2005


I like that. More of what I was looking for and in just a very few
lines. 

Thanks Dale!

On Tue, 2005-03-22 at 10:53 -0500, Dale Lancaster wrote:
> my @input=(1,2,3,4,3,2,1) ;
> my ($j, $i) ;
> grep { $i++ ; $j=$i-1 if $_ =~ /3/  and !$j ; } @input ;
> print $j ;



More information about the charlotte mailing list