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("%0${padlen}d",$i);

   print "$i\n";
}


- - -Jon Cormier


                                                                           
             "Mehta, Perdeep"                                              
             <[EMAIL PROTECTED]                                             
             JUDE.ORG>                                                  To 
             Sent by:                  <[EMAIL PROTECTED] 
             perl-unix-users-b         te.com>                             
             [EMAIL PROTECTED]                                          cc 
             ctiveState.com                                                
                                                                   Subject 
                                       [Perl-unix-users] looping over      
             02/23/2005 12:04                                              
             PM                                                            
                                                                           
                                                                           
                                                                           
                                                                           




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; $i++) {
   print $i;
}

Is this a print formatting problem? Could some one help?

Thanks in advance,
perdeep

Perdeep K. Mehta
St. Jude Children's Research Hospital
Memphis, TN 38105-2794


_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to