Skip to content

Instantly share code, notes, and snippets.

@alexagranov
Created November 2, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexagranov/464bd8212b3c04a0da73f3f064d580a6 to your computer and use it in GitHub Desktop.
Save alexagranov/464bd8212b3c04a0da73f3f064d580a6 to your computer and use it in GitHub Desktop.
Count number of tabs per line
#!/usr/bin/perl
use strict;
use warnings;
use v5.18;
my $MAX_TABS = 22;
while (<STDIN>) {
chomp $_;
my $c = ($_ =~ tr/\t//);
if ($c > $MAX_TABS) {
say "There are $c on line $.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment