Keep It Simple, Stupid | |
PerlMonks |
Re: Using an array element as a loop iteratorby 2teez (Vicar) |
on Nov 07, 2013 at 19:46 UTC ( [id://1061615]=note: print w/replies, xml ) | Need Help?? |
Hi gurpreetsingh13, Of course, the answer you get is 2,4 and 6. Atleast that is what you have using the OP as showed by using the C-style for loop, which you supposed worked and indeed it worked since it gave you your desired result, BUT did you check your "@a" variable after that to see it values? Please do and see what you have! Using Data::Dumper
If you tell me, I'll forget. If you show me, I'll remember. if you involve me, I'll understand. --- Author unknown to me
In Section
Seekers of Perl Wisdom
|
|