Basic HTML version of Foils prepared Sept 20 97

Foil 27 Some Remarks about Subroutines - IV -- Call by Reference

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


sub doublearray {
my(*arraypointer) = @_;
foreach $elem (@arraypointer) {
  • $elem *= 2;
}
} # End routine to double elements of an array
# Suppose @foo and @bar are arrays:
doublearray(*foo); # doubles elements of @foo
doublearray(*bar); # doubles elements of @bar



© 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