my $element = "catchme"; my @array = ( "catchme", "if", "you", "can" ); if ( @found = grep { $_ eq $element } @array ) { my $found = join ",", @found; print "Here's what we found: $found\n"; } else { print "Sorry, \"$element\" not found in \@array\n"; }