in reply to finding { and }
#!/usr/bin/perl -w open (LOG, ">>threadcheck.log") || &Error($!); $now = localtime; print LOG "Log Created on $now \r\n"; my $lines = 0; foreach $FILE (<*.c *.C *.cpp *.CPP *.h *.H>) { open (FIL, "<$FILE") || die $!; #changed ">>" to "<" print LOG "File $FILE was opened on $now \r\n"; while (<FIL>) { $lines++; my $brackets; foreach $word ( split ) { if ($word =~ /\{/ ) #or if ($word =~ m'\{' ) { print LOG "New open bracket \r\n"; $brackets++; } if ($word =~ /}/ ) #or if ($word =~ m'}' ) { print LOG "New closed bracket \r\n"; $brackets--; } print LOG "Number of unclosed brackets in file $FILE: $brackets\ +r\n"; } print LOG "Number of lines in file $FILE: $lines\r\n"; } close FIL } close LOG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: finding { and }
by dudi (Initiate) on Oct 17, 2001 at 02:18 UTC | |
Re: Re: finding { and }
by Hofmator (Curate) on Oct 17, 2001 at 15:21 UTC |