Skip to content

Instantly share code, notes, and snippets.

@dougluce
Created August 8, 2016 19:39
Show Gist options
  • Save dougluce/832a235ea9b49646a6003bd691cf6331 to your computer and use it in GitHub Desktop.
Save dougluce/832a235ea9b49646a6003bd691cf6331 to your computer and use it in GitHub Desktop.
while(<>) {
chomp;
my $len = length($_);
my $steps = int(log($len)/log(10));
for (my $o = $steps; $o >= 0; $o--) {
my $n = 1;
for (my $i = 0; $i < $len-(10**$o)+1; $i+= 10**$o) {
print " " x ((10**$o)-1) . ($n++ % 10);
}
print "\n";
}
print "$_\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment