Mega Code Archive

 
Categories / Perl / Array
 

Using Arrays as an Indexed List

@months = qw (JUNK Jan Feb March April May June July Aug Sept Oct Nov Dec); #assign the same values to the list @array. @array = qw (a b c d e); @array = ("a", "b", "c", "d", "e"); #For example, you could have set the @months array in the following fashion: #   $months[0] = "JUNK"; #   $months[1] = "Jan"; #   $months[2] = "Feb";