in reply to Returning and passing data to and from subroutines
my @data = shift; [download]
my @data = @_; [download]
Your code only loads the @data array with one element.
See shift and perlsub.