#!/usr/bin/perl use warnings; use strict; my @a = qw( a1 a2 a3 ); my @b = qw( b1 b2 b3 ); my %c = ( a=>1, b=>2 ); my %d = ( c=>3, d=>4 ); sub multi_flat { # my ( @foo1, @foo2 ) = what should go here? # my ( @foo1, @foo2 ) = ( shift, shift ) ? # my ( @foo1, @foo2 ) = ( $_[0], $_[1] ) ? my @foo = @_; #this flattens the arrays into one print join( ", ", @foo), "\n"; } multi_flat( @a, @b ); #prints "a1, a2, a3, b1, b2, b3" multi_flat( %c, %d ); #prints "a, 1, b, 2, c, 3, d, 4" sub multi_fixed_arr { my ( $arr1, $arr2 ) = @_; print "\$arr1 is ", join( ", ", @$arr1), "\n"; print "\$arr2 is ", join( ", ", @$arr2), "\n"; } sub multi_fixed_hash { my ( $hash1, $hash2 ) = @_; print "keys \$hash1 is ", join( ", ", keys %$hash1), "\n"; print "keys \$hash2 is ", join( ", ", keys %$hash2), "\n"; } multi_fixed_arr( \@a, \@b ); #prints: $foo1 is a1, a2, a3 # $foo2 is b1, b2, b3 multi_fixed_hash( \%c, \%d ); #prints: keys $foo1 is a, b # keys $foo2 is c, d sub pop_one { my @arr1 = @_; pop @arr1; } print join( ", ", @a), "\n"; #prints "a1, a2, a3" pop_one( @a ); print join( ", ", @a), "\n"; #prints "a1, a2, a3" sub pop_one_fixed { my $arr = shift; pop @$arr; } print join( ", ", @a), "\n"; #prints "a1, a2, a3" pop_one_fixed( \@a ); print join( ", ", @a), "\n"; #prints "a1, a2"