在Perl中查找文件中的选项卡和空格

We are doing the our code review manually. It's eating our more time to review the each and every file. We are checking below generic items for all the files. It would be good if any automated script in Perl / Php for code review.

  1. List out the total number of tabs used inside the files.
  2. List out the total number of white spaces inside the files.

Kindly help to create automated tool for code review.

Thanks in advance.

I'm amused by the idea of you or someone manually counting the tabs.

Count tabs:

perl -ne '$c += () = /\t/g; END{print qq{$c}}' file.pl

or

perl -ne '$c += tr/\t//; END {print qq{$c}}' file.pl

And similarly for white spaces:

perl -ne '$c += tr/ //; END {print qq{$c}}' file.pl