No, it's not working, probably you didnt' get my question.
Anyways, thanks for a prompt reply.
Sara.
----- Original Message -----
From: "Ovid" <[EMAIL PROTECTED]>
To: <beginners-cgi@perl.org>
Sent: Friday, September 09, 2005 12:01 AM
Subject: Re: Exact matching using GREP.
--- Sara <[EMAIL PROTECTED]> wrote:
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.
Assuming I understood your question correctly:
if (grep { $_ eq $row->{CAT_TITLE} } @present) {
# do something
}
Cheers,
Ovid
--
If this message is a response to a question on a mailing list, please send
follow up questions to the list.
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>