Basic HTML version of Foils prepared April 16,1996

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

From Perl5 and Advanced Perl4 Features Computational Science for Information Age Course CPS616 Material -- April 16,1996. by Geoffrey C. Fox


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
  • foreach $aref ( @_ ) { # $aref loops over arguments
    • push(@retlist, pop(@$aref) ); # @$aref is global array pointed to in argument
  • } # Now we have popped off last element in each input array
  • return @retlist; # @retlist has last element of each array passed
}



© 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 Sat Sep 6 1997