c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dump qq(pp); ;; my $entab = 4; ;; my @lines = ( qq{This line has no tab.\n}, qq{\tThis line has tab at the beginning.\n} ); ;; for my $line (@lines) { my $rend = ($line =~ tr/\t//c) + ($entab * $line =~ tr/\t//); printf qq{%s renders as %d chars long \n}, pp($line), $rend; } " "This line has no tab.\n" renders as 22 chars long "\tThis line has tab at the beginning.\n" renders as 40 chars long