Basic HTML version of Foils prepared Sept 20 97

Foil 29 Some Remarks about Subroutines - VI -- Separating Arguments

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 popmany { # See previous foil for use
my $aref; # A local scalar to hold pointer to array
my @retlist = (); # An array to hold returned list
# Pop last element in each input array:
foreach $aref ( @_ ) { # loop over arguments
  • # @$aref is global array pointed to in argument:
  • push(@retlist, pop(@$aref) );
}
# @retlist holds last element of each array passed
return @retlist;
}



© 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