Thanks Bill. This is the closest one that I eventually liked, nevertheless 
there were other useful ones.

Thanks to every one for the input and useful ideas.

perdeep

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


-----Original Message-----
From: $Bill Luebkert [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 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?

foreach ('001' .. '100') {
   print $_, "\n";
}

or

print $_, "\n" foreach '001' .. '100';

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)


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

Reply via email to