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


$coderef = \&subroutine; # pointer to a subroutine!
  • accessed by &$coderef(arguments);
$globref = \*STDOUT;
  • used as in print $globref "We used a pointer to file handle\n";
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
Thus $$scalarref is equivalent to ${$scalarref};
$$hashref{"key"} is equivalent to ${$hashref}{"key"} or $hashref->{"key"}



© 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