Mega Code Archive

 
Categories / Perl / Statement
 

Use for loop to output all elements in an array

@array = ("one", "two", "three"); for ($loop_index = 0; $loop_index <= $#array; $loop_index++)  {     print $array[$loop_index] . " "; }