in reply to Re^4: Comparison between a string and an array
in thread Comparison between a string and an array

You're right.

The better way to write it would probably be:

my $match = 'Ba'; my @array = ('Ba Ba Black Sheep'); if (grep(/^$match$/,@array)) { print 'exact match?'; } else { print "No match\n"; }