Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Index of Items in Array using foreach loop

by tmharish (Friar)
on Feb 22, 2013 at 10:48 UTC ( #1020130=note: print w/replies, xml ) Need Help??


in reply to Index of Items in Array using foreach loop

Yes - use the for loop:

for( my $Arrayindex = 0; $Arrayindex <= ( $#SampleArray ); $Arrayindex +++ ) { print $SampleArray[ $Arrayindex ] , ' is at location ' , $Arr +ayindex , ' in the array' , "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020130]
help
Chatterbox?
[Discipulus]: ;=)
[Discipulus]: you are rigth: 2018 had less bad days than 2017, until now!
[Discipulus]: if i had to go to psycho i need to ask why i always end with over complex datastructure: now i have an HoHoAoH in my object
[Discipulus]: i will need to handle by reference later on
[Eily]: kinda sounds like father Christmas is late
[hippo]: (asking because I'm sure you said before about learning English) Did you know there are 2 different words for smaller quantities in English? They are "less" and "fewer". Fewer applies to a number of discrete things like days.
Eily notes also

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-01-23 09:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (242 votes). Check out past polls.

    Notices?