A program that prints every element of an array. : Array Output « Array « Perl






A program that prints every element of an array.

   
#!/usr/local/bin/perl 

@array = (14, "abc", 1.23, -7, "ddd"); 
$count = 1; 
while ($count <= @array) { 
   print("element $count: $array[$count-1]\n"); 
   $count++; 
} 

   
    
    
  








Related examples in the same category

1.Output the whole array in print
2.Months Of The Year
3.Print each value in the array.
4.Output nested array
5.Output all elements in an array with print command
6.Output the last element in the array
7.Output the number of elements and the last index number
8.print "@{[uc(hello)]} there.\n";