in reply to need to increment a $scalar while inside for loop

If I understand you correctly, what you want are symbolic references which are sometimes referred (no pun intended) as soft references. From pg 254 of the Camel book:
$name = "bam"; $$name = 1; # sets $bam ${$name} = 2; # sets $bam ${$name x 2} = 3 # sets $bambam
I think you get the idea. I will leave the rest up to you. Hope that helps.

Replies are listed 'Best First'.
Re (tilly) 2: need to increment a $scalar while inside for loop
by tilly (Archbishop) on Jan 07, 2002 at 04:37 UTC
    FYI if someone is describing what they want to do, and it looks like they want symbolic references, I would strongly recommend warning them away from them into a different course of action.

    The standard article I refer them to for this is Avoid symbolic variables, and I tell them to read all three parts. (The third in particular has a very nice statement of why safe programming practices matter.) And then I suggest strict.pm to them.,,