Basic HTML version of Foils prepared Sept 20 97

Foil 16 Hard References in Perl5 - 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 $coderef = \&subroutine; # pointer to a subroutine!
  • accessed by &$coderef(arguments);
2 $globref = \*STDOUT;
  • used as in print $globref "We used a pointer to file handle\n";
3 Note in dereferencing, one can use curly braces {} either to disambiguate or to change scalar holding hard reference to a BLOCK returning a reference of correct type
4 Thus $$scalarref is equivalent to ${$scalarref};
5 $$hashref{"key"} is equivalent to ${$hashref}{"key"} or $hashref->{"key"}

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