On 21/06/2011 15:01, Bob McConnell wrote:
From: Paul Johnson
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 //
You need to be a little more careful about those assumptions.
He is looking for all keywords that are not in UPPERCASE.
In fact not, the OP corrected his requirement later on
On 15/06/2011 07:56, Beware wrote:
So, this is what i want to do :
I've source code files in VHDL. I want to check that all specific
keywords of this language are in uppercase.
In fact, in my current script i read this file line per line and
check others rules.
Am i clear, now?
The working solution that I prefer is Paul's
On 15/06/2011 12:10, Paul Johnson wrote:
my $kw = join "|", @keywords;
while (<>) {
for my $w (/(\b${kw}\b)/ig) {
warn "Keyword '$w' not uppercase at $ARGV:$.\n" unless $w eq uc $w;
}
}
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/