Basic HTML version of Foils prepared April 16,1996

Foil 20 There really are only 1D Arrays and Hashs! - I

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 Material -- April 16,1996. by Geoffrey C. Fox


All multiple dimensional data structures are implemented as arrays of references
In $Lol2D[$x][$y] one stores an array labelled by $x of hard references
Each hard reference is to an anonymous 1D array whose elements are accessed by $y
for $i (1..10) {
  • @list = somefunc($i); # grab a list labelled by $i
  • $LoL[$i] = @list; # sets $LoL[$i] as the number of elements in @list as evaluated in scalar context or
  • $LoL[$i] = scalar @list; # is same as above more pedantically or see next foil



© 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