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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: returning tied array
by strat (Canon) on Jan 08, 2007 at 09:33 UTC |
In Section
Seekers of Perl Wisdom