# get the reference to the array [args] my $ref = shift; # 1st element in array = reference to %formdata # 2nd element in array = scalar $filelocation my $hashref = $ref->[0]; my $fileloc = $ref->[1];