in reply to perl's grep function with '^' and '$'
Indeed you are, you should be using qw not qq. See perlop
# Program : 3 #!/usr/bin/perl use strict; my $match = 'A'; my @array = qw[Anthony Mark Alex A]; if ( grep( /^$match$/,@array ) ) { print "Matched\n"; }
|
---|
In Section
Seekers of Perl Wisdom