Please bottom post....

Sara wrote:
> No, it's not working, probably you didnt' get my question.

How is it not working now?  What Ovid sent is exactly what I would have
answered so you probably need to provide more information. You mention
man pages and switches to grep, there are two greps here, 1) the command
line program used for searching files which is where your -x, etc. come
in and 2) 'grep' the function which is a Perl built-in. For the docs for
it, you need to check:

perldoc -f grep

They are very different things.

http://danconia.org

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

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