(@ary1, $num) = read_data(\@tmpary, $tmpsclr); ... sub read_data { ... do stuff with @retary and $count return @retary, $count; }