$ perl -le' my $line = " This is the test line"; $line =~ /^\s+/ and print $+[ 0 ]; ' 1