in reply to Best tool for my requirements?
$_ = join '', <DATA>; # Remove comments that don't start the line s/^.+\/\*.*?\*\//-/mg; # Remove comments spanning multiple lines s/\/\*(.*?)\*\/.*?\/\*\1\*\///sg; # Remove ignored characters s/[{} ]+//g; map { $c++ if $_; } split /\n/, $_; print "$c lines of code."; __DATA__ /* LM-2006-01 */ multi-line comment /* LM-2006-01 */ for (i = 0; i < 10; i++) { int my var; /* LM-2006-01 */ } /* LM-2006-01 */ another multi-line comment /* LM-2006-01 */
|
|---|