Online Learning Applications for Technical English


Home
Syllabus
Assignments

Instructor



Producing Homepages

Arrays

We use an array to hold a list of values. The name of an array begins with an '@' sign and the individual elements can be accessed using sequential integer indices, beginning at zero. For example,

  @data_lines = ( "Aki, 30", "Ben, 5", "Cathy, 15" );
  
  print $data_lines[0];       # Prints "Aki, 30"
  print "$data_lines[0]\n";   # Prints "Aki, 30" with a newline at the end
  print $data_lines[1];       # Prints "Ben, 5"
  print $data_lines[2];       # Prints "Cathy, 15"

[ Back ]