Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: returning tied array

by nobull (Friar)
on Jan 07, 2007 at 13:54 UTC ( [id://593394]=note: print w/replies, xml ) Need Help??


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.8.8.32.11.32"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://593394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-26 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found