in reply to getting arrays into subroutines
Short answer: Pass references to the arrays as:
... sub something { my ($ary_ref1, $ary_ref2, $ary_ref3) = @_; ... } ... something( \@ary1, \@ary2, \@ary3 ); ... [download]
Long answer: Read perlreftut and perlref