Tabs or spaces for indentation? Statistics on 3.8 million Perl files created in 24 years

I spotted this on The Twitter, someone processed lots of code to find the truth on this topic of disagreement.

"After I have processed data in the database, I decided to watch from each author he uses for padding. I expect that the most popular will be the use of only spaces, the second place by popularity will be using only tabs, and the third place in popularity is the simultaneous use of tabs and spaces. But it turned out that I was completely wrong. "

Read on: https://squareperl.com/en/tabs-vs-spaces-in-millions-of-perl-files

2 Comments

I read the article with interest. I consider myself a "tabs only" author and was surprised that there were so few of these found. But I discovered that most of my files had both.

Looking further I saw that all of my leading spaces were in blocks of text meant to go to the console (mainly usage messages) where you cannot count on what a tab is going to look like.

I indent code with tabs, but for code samples in pod, I use two or three spaces. This is because a lot of pod formatters will expand a tab to eight columns (which is very wide and limits the length of code that can be displayed).

So from the perspective of this analysis, where pod was included, I use a mixture of tabs and spaces, even though I'm a very strong proponent of using tabs only for indentation.

Leave a comment

About Dean

user-pic I blog about Perl. Need an open source firewall or some perl work in Australia? Give me a call!