--- 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>


Reply via email to