The simplest, most naive way to do this is wc -l or the equivalent in Perl, which would look something like
#!/usr/bin/perl my $lc = 0; while ( <> ) { $lc++ } print "$lc\n";
The meta problem depends on what you're going to use the LOC count for. If you're trying to draw a parallel between actual code and lines of text for some purpose that will eventually involve rating coders, you're in for a lot of trouble. People quickly figure out how to generate lots of lines of stuff when they're being graded on it. Simple ways of counting can lead to stupid behavior.
In reply to Re: LOC
by dws
in thread Counting lines of C code
by Sara
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |