http://qs321.pair.com?node_id=593394


in reply to returning tied array

Another solution is to declare @array in the main program and pass a reference to &TieVariable.
TieVariable(\my @array); ### Pos1 print "### Initialization finished\n"; for (0..$#array) { print "$_: $array[$_]\n"; } # for $array[6] = 1000; untie @array; sub TieVariable { my $array = shift; tie @$array, 'Tie::Excel::Array'; $array->[$_] = 5 * $_ for 0..5; }

You can get rid of then need for the backlash at Pos1 by giving TieVariable a prototype, but I would not recommend it.