![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
An array is a named list. As with lists, its space is dynamically allocated and removed, it is 0-indexed, and shares all the operators, and some new accessors
@stringInstruments = ("violin","viola","cello","bass");
@brass = ("trumpet","horn","trombone","euphonium","tuba");
$biggestInstrument = $stringInstruments[3];
print("orchestral brass: ",
join(" ",@brass[0,1,2,4] ),
"\n");
| Some Array functions | |
|---|---|
| in addtion to list functions | |
| push(@ARRAY,LIST) | add LIST to the end of @ARRAY |
| pop(@ARRAY) | remove and return the last element of @ARRAY |
| unshift(@ARRAY,LIST) | add LIST to the front of @ARRAY |
| shift(@ARRAY) | remove and return the first element of @ARRAY |
| scalar(@ARRAY) | return the number of elements in the array |
![]()
The National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
[email protected]
Last modified: June 19, 1997