#!/usr/bin/perl -w @numberarray = qw(00000900011 10001000100 00022200101); for $digits (@numberarray){ @temparray = split (//,$digits); $incr=0; while ($temparray[0] eq 0) { shift @temparray; $incr++; } unshift (@temparray," "x$incr); $digits = join('',@temparray); print "$digits\n"; } #### #!/usr/bin/perl -wl use strict; my @numberarray = qw(000000 000002 001110 010201 010010 001000 000120 010030); for (@numberarray){ next if $_ == 0; my @array = split //; my $incr = 0; while ($array[0] eq 0) { shift @array; $incr++; } unshift (@array,"\x20" x $incr); print @array; }