in reply to Re: Line-counts of perl programs/modules
in thread Line-counts of perl programs/modules
What about the all too (perhaps not completely understood by me) easy
print "Total lines in $0: ". __LINE__ ."\n";
Could you just put that at the end of your script? That would give you your line count wouldn't it?
Although I admit that the original question is a very good one and one that I am quite interested to see a more "official" answer to. I am still quite new to Perl and I do the wc route to getting my line counts for my scripts. Actually, I do something closer to:$ perl cool.pl My output from the script Total lines in cool.pl: 37
$ egrep -v "^#" script.pl | wc -l
or something more informative...
echo "$(egrep -v "^#" script.pl) - $(egrep "#" script.pl)" | bc
Which would at least give me my actual lines of code minus my comments. I just finished a script that was 1/3 comments.
----------
- Jim
|
---|
In Section
Seekers of Perl Wisdom