Harry Putnam wrote:
> Taking the chicken way out... but I can't think of the right tricky
> search strings to uncover a tried and true way to output a 3 digit
> padded numeric series.  In this case its for file names.  And needs to
> roll over to 4 digit in the event there are enough files.
> 
> There is no problem of clobbering since files are being renamed as
> they are moved to a new clean directory.  I just can't recall how to
> make my incremented counter start at 000 and go:
> 001.ext
> 002.ext
> 003.ext
>  etc.
> 
> Its just the numeric part I need a jump start on.

$ perl -le'
for my $number ( 0 .. 4, 997 .. 1003 ) {
    my $filename = sprintf q[%03d.ext], $number;
    print $filename;
    }
'
000.ext
001.ext
002.ext
003.ext
004.ext
997.ext
998.ext
999.ext
1000.ext
1001.ext
1002.ext
1003.ext



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to