#!/usr/bin/perl # set up an array @array = ("hi", 42, "hello", 99.9); # print the whole array print "The array contains @array\n"; # access the 2nd element --- counting starts from 0 # note also we use scalar syntax ($) for a particular element # because a single element is a scalar print "The second element is $array[1]\n"; # this prints 42 not "hi" $length = @array; print "There are $length elements in the array\n";