> for (my $i = 001; $i < 100; $i++) { > > $padlen=3; > $i = sprintf("%0${padlen}d",$i); > > print "$i\n"; > }
Slightly more compact: printf("%03d\n", $_) for (1..100); _______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs