Gowtham schreef:
> Martin Barth:

>>> for my ($index = 0; $index <= 10; $index++) {
>>>    print ("$hour:$min:$sec\n");
>>> }
>>
>> for my $index (0..10){
>>         print ("$hour:$min:$sec\n");
>> }
>
> Don't wrap the entire loop initializer, condition and
> counter update in my(). [...]

Gowtham, you are replying to the wrong message, your reply si about what
CM wrote.

Moreover, Martin's variant shows a cleaner approach. Since $index isn't
used inside the loop, you could also go for

   print "$hour:$min:$sec\n" for 0..10;

-- 
Affijn, Ruud

"Gewoon is een tijger."


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


Reply via email to