#!/usr/bin/perl -w use strict; my @p_types = qw( pam php kph ); my @c_types = qw( cam c1 c2 ); my @true = qw( pam c2 ); # Gets true my @false = qw( cam c2 ); # Gets false my @p_type = grep $_, @p_types foreach @true; my @c_type = grep $_, @c_types foreach @true; print "Array consists of elements from both arrays\n" if ( @p_type && @c_type ); #### #!/usr/bin/perl -w use strict; my @p_types = qw( pam php kph ); my @c_types = qw( cam c1 c2 ); my @true = qw( pam c2 ); # Gets true my @false = qw( cam c2 ); # Gets false my @p_type = grep $_, @p_types foreach @false; my @c_type = grep $_, @c_types foreach @false; print "Array consists of elements from both arrays\n" if ( @p_type && @c_type );