my @present = ('perl', 'perl/chat', 'php', 'php/forums', 'php/counters',
'perl/search/scripts', 'php');
# Getting Results for mySQL query in hashref.
while (my $row = $sth->fetchrow_hashref)
{
if (grep /$row->{CAT_TITLE}/, @present) {
#matching title with @present elements
print "$row->{CAT_TITLE}";
}
Question is how to do EXACT matching using GREP? because the above code prints
every element from array for 'php' if the $row->{CAT_TITLE} is 'php' it prints
php/counters, php/forums and every element containing php.
How I am supposed to do Exact matching that if $row->{CAT_TITLE} is 'perl/chat'
it should pick only 'perl/chat' from @present.
I saw the Unix man pages and did other searches and found '-x' switch to use
for exact matching with GREP and '-e' switch for pattern matching but dont'
know how to incorporate it within my code.
TIA,
Sara