Basic HTML version of Foils prepared March 30 97

Foil 23 Arrays and Lists of Scalars(data) VIII -- Operators on Arrays (Chapter 3 of Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


push adds information at end of a list(array)
  • push(@stack,$new); # is equivalent to @stack = (@stack, $new);
  • One can also use a list for second argument(s) in push as in
  • push(@stack,6,"next",@anotherlist);
pop is inverse operator to push and removes the last element in argument as well as returning value of this last element
  • Note chop(@stack) removes last character of each entry of list -- not like pop which removes last entry of list
unshift is idential to push except works on left (lowest indices) of list -- not on end of list
shift is idential to pop except works on left (lowest indices) of list -- not on end of list
reverse(@list) leaves @list unaltered but returns reversed list
sort(@list) leaves @list unaltered but returns sorted list



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Sep 6 1997