in reply to Passing multiple data types to a subroutine

You can pass multiple datastructures (and data types) of arbitrary complexity into subs by reference. For example:

my %hash = ( 'This' => 1, 'That' => 2, 'Other' => 3 ); my @array = ( 1, 2, 3, 4, 5 ); my $scalr = "Hello World!\n"; mytest ( \%hash, \@array, $scalr ); sub mytest { my $h_ref = shift; my $a_ref = shift; my $simple = shift; local $, = ", "; print $h_ref->{$_}, "\n" foreach keys %{$h_ref}; print $_, "\n" foreach @{$a_ref}; print $simple, "\n"; }

Take a look at perlreftut and perlsub for a more detailed description, and clever examples.


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein