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

    nobull: Thank you very much. The current version uses the alias version, because I have been thinking in a much too complicated way. The "Call-by-Reference" does exactly what I was looking for, and I will use it for the next version.

    When it is finished, I'll post the script under Cool Uses For Perl ;-)

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8."