@input=('a','b','c','d'); my $char='b'; print "$char is at position(s): ", join(", ", grep { $char eq $input[$_] } 0..$#input), "\n";