On Tue, Jun 21, 2011 at 05:57:22AM -0700, Beware wrote:

> Hi to all,
> 
> First of all, sorry for the late of my answer.
> Thank for all your sentence.
> 
> Here's my solution (for now) :
> 
> for my $w (@keywords)
>       {
>          if ( /\b$w\b/ and !/\buc($w)\b/ )
>          {
>             print "Keyword '$w' not uppercase line $.\n";
>             ajoute_erreur( 7, $. );
>             last;
>          }
>       }
> 
> It's probably less fast than other ones, but it seems to work.

I'm afraid you may need to improve your testing skills.

I assume your keywords are in lower case.  What happens with mixed case?  You
would need /i on your first //

uc($w) isn't doing what you think it is - you were wanting \U$w\E

But the trouble with your method is that you will miss things like
"a and b AND c" because it *will* find the uppercase version on the line.

Also, you probably don't want the "last" there or you'll only ever find one
error per line.

I refer the right honourable Gentleman to my previous answer.

Good luck,

-- 
Paul Johnson - p...@pjcj.net
http://www.pjcj.net

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to