sub poo { my ( $first, $second, $third ) = @_; my $total_length = 0; foreach my $array_ref (@_[1,0,2]) { print join(' ', @$array_ref[1..$#$array_ref,0]), ' ', length($array_ref->[0]), "\n"; $total_length += length($array_ref->[0]); } print "$total_length\n"; }