Hi all,
i've a question on my perl script.
In my script i read a file line per line, and check if keywords are in
uppercase. To do that, i've an array filled with all used keywords.
On each line, i check all keywords with a foreach loop.
Well, this is my code :
my $lines = 0;
while ( <SOURCE> )
{
# cut '\n'
chomp($_);
#List of keywords
my @keywords = ("all", "wait", "for");
#Check all keyword
foreach $item (@keywords)
{
# keywords detected
if ( /$item\b/i and !/\s*--/)
{
# remove keywords already in uppercase
my $temp = $_;
my $item_maj = uc($item);
$temp =~ s/$item_maj//g;
# check if any keywords
if ( $temp =~ /$item\b/i )
{
print "keywords is lowercase line : ".$lines."\n";
last;
}
}
}
$lines++;
}
close ( SOURCE );
Well, thanks for your answer
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/