Basic HTML version of Foils prepared
March 30 97
Foil 19 Arrays and Lists of Scalars(data) IV -- Element Access (Chapter 3 of Llama Book)
From
PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 --
February 1995
.
by
Geoffrey C. Fox
Note that @fred and $fred are totally different variables -- one an array and the other a scalar
However the elements of @fred are scalars and like C are labelled starting at 0 not 1 (as in Fortran) -- such elements are referenced by $ NOT @
$a = $fred[0]; # is first element in @fred which we can set explicitly by
$fred[0]= "First element of \@fred"; # note get variable interpolation for arrays as well as scalars and so one must "escape(protect)" @ in string
©
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