Print an element in a list of variables : Array Item « Array « Perl






Print an element in a list of variables

    
#!/usr/bin/perl 
print "Content-Type: text/html \n\n"; 
# This script demonstrates how to print an element in an array 
@AcmeCars = ("Ford","Dodge","Chevy"); 
print "<p>* $AcmeCars[0] * is the first element 
in the text array.</p>"; 
print "<p>* $AcmeCars[2] * is the third element 
in the text array.</p>"; 

   
    
    
    
  








Related examples in the same category

1.An array is an ordered list of scalars: strings and/or numbers.
2.Arrays: a collection of similar data elements
3.A program that prints the elements of a list.
4.Store various type values in an array
5.Append two arrays to form another array
6.Duplicate array elements
7.Mixed Lists
8.Mixed Data Assigned to Array Cells
9.Array Elements
10.Append to array
11.Get array last element
12.Creating and initializing an array with list assignment