RE: [Perl-unix-users] looping over

2005-02-24 Thread Mehta, Perdeep
bkert [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2005 6:55 PM To: Mehta, Perdeep Cc: perl-unix-users@listserv.ActiveState.com Subject: Re: [Perl-unix-users] looping over Mehta, Perdeep wrote: > Hi All, > > I want to loop over numbers 001 to 100 as index. For or foreach loops b

Re: [Perl-unix-users] looping over

2005-02-23 Thread $Bill Luebkert
Mehta, Perdeep wrote: > Hi All, > > I want to loop over numbers 001 to 100 as index. For or foreach loops both > convert the variable value, for example $i = 001 to $i = 1. > > I'm sure there is a way to explicitly get $i = 001 printed out, instead of $i > = 1 that script automatically changes

Re: [Perl-unix-users] looping over

2005-02-23 Thread pDale Campbell
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2005 11:15 AM To: Mehta, Perdeep for (my $i = 001; $i < 100; $i++) { $padlen=3; $i = sprintf("%0${padlen}d",$i); print "$i\n"; } - - -Jon Cormier Hi All, I want to loop over numbers 0

RE: [Perl-unix-users] looping over

2005-02-23 Thread Thomas, Mark - BLS CTR
> 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

RE: [Perl-unix-users] looping over

2005-02-23 Thread Mehta, Perdeep
Thank you for the help. It works. pm -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 23, 2005 11:15 AM To: Mehta, Perdeep Subject: Re: [Perl-unix-users] looping over for (my $i = 001; $i < 100; $i++) { $padlen=3; $i = sprintf(

[Perl-unix-users] looping over

2005-02-23 Thread Mehta, Perdeep
Hi All, I want to loop over numbers 001 to 100 as index. For or foreach loops both convert the variable value, for example $i = 001 to $i = 1. I'm sure there is a way to explicitly get $i = 001 printed out, instead of $i = 1 that script automatically changes it to. for (my $i = 001; $i < 100;