#!perl use strict; sub iA{join('',map{$_ if($_[0]eq$_[$_])}(1..$#_))-1} my(@array) = qw(foo bar crap stuff); print "$_: ".iA($_,@array),"\n" for(qw(foo dolsman crap));