Posts

Showing posts with the label perl script for count line

Powerful PERL Script for Large codes

Count lines of code in a C,C++,Java,perl,shell,html,VHDL,Verilog or Python file     #!/usr/bin/perl -0777 my @lines = (); my $numofifs = 1; my $commentstarted = 0; my $notacfile = 0; if($ARGV[0] !~ /\.[cCh]$/) {   $notacfile = 1; } while(<>) {      s/\/\*(.*?)\*\//cOmMeNt/gms;      s/<!--(.*?)-->/cOmMeNt/gms;      @tmp = split(/\n/);      for(@tmp) {      if (/cOmMeNt/) {                 unless(/cOmMeNt/ ) { $_ = $_ . "\n";                         push(@lines, $_); next;                  }                  else {                     if((/[\S]+[\s]*cOmMeNt/) || (/cOmMeNt[\s]*[\S]+/)) {         ...