in reply to Line-counts of perl programs/modules
Perhaps I've totally missed the point, but if you want to add line numbers
to your program, you could include this snippet in every program you
write.
So, you could type:sub lines_count { open IN, "< $0" || die "Can't open file (black magic?)\n"; while( <IN> ) { chomp; printf "%3d: %s\n", $., $_; } close IN; }
perl my_script.pl -e lines_count > something_that_let_you_print. (Maybe) Useful on system where wc does not exist.
Update Sorry, I've said something wrong. From perlrun...
-e commandlineSo what you could write is:
may be used to enter one line of script. If -e is given, Perl will not look for a script filename in the argument list. Multiple -e commands may be given to build up a multi-line script. Make sure to use semicolons where you would in a normal program.
perl -e 'while (<>) {chomp; printf "%3d: %s\n", $., $_; }' < some_script > something_that_let_you_print
Sorry :)
In Section
Seekers of Perl Wisdom