Basic HTML version of Foils prepared Sept 20 97

Foil 20 Arrays and Lists of Scalars III -- Construction

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


More complicated lists may be constructed:
($a, @fred) = @fred; # sets $a to first element of @fred and then removes this first element from @fred
($a,$b,$c) = (1,2,3); # sets $a=1, $b=2, $c=3
Curiously, setting a scalar equal to an array returns the length of the array
$a = @fred; # returns $a as length of @fred
The function length returns the number of characters in a string
$a = length (@fred); # returns length in characters of first entry in @fred
($a) = @fred; # sets $a to be first entry of @fred



© 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 Sun Sep 21 1997