Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Line-counts of perl programs/modules

by snafu (Chaplain)
on Apr 27, 2001 at 17:31 UTC ( #76077=note: print w/replies, xml ) Need Help??


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?

$ perl cool.pl My output from the script Total lines in cool.pl: 37
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:

$ 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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76077]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2022-08-08 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?