Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

naming arrays dynamically

Status
Not open for further replies.

user2base

Technical User
Oct 16, 2002
29
0
0
GB
I am using Parallel::ForkManager to fork a subroutine used in a perl script. This subroutine uses an array (called @array).

My script get confused because (I reckon) of the name of the array is shared by all forked children.
So that, the content of @array might not be the one I expect to be.

So I need to find a way to name this array dynamically so that it has a different name each time the subroutine is forked. I was thinking of using the value of the argument ($arg) passed to the subroutine (which is unique among all the fork processess)

How do I construct the name of my array ?

I tried something like: @(array.$arg) but it doesn't work...

Any idea ?

Thx,
U.



 
what you re trying to do is a soft reference, documented in
Try @{ "array.$arg" }

good luck, "As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top