Basic HTML version of Foils prepared Sept 20 97

Foil 23 The -> Pointer Notation -- II

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


1 @LoL2D = ( [1,2], [1,2,3] ); # Constructs a 2D array
2 $ref_to_LoL2D = [ [1,2], [1,2,3] ]; # creates a pointer to a 2D array
3 $arraypt =\@{$LoL2D[$i]}; # extracts a slice ($i'th row) from $LoL2D[$i][$j]
4 $$arraypt->[$j] is equivalent to $LoL2D[$i][$j]
5 Perl5 is operationally like Fortran and acts as though right most elements are least significant and stored "consecutively"
6 If one has defined attributes for students with components such as $student{"grade"}, then $student[$classmember]{"grade"} is way to address a class of students

in Table To:


© 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 Apr 5 1998