in reply to unsure how to use variable

our $holding1 = "green"; our $holding2 = "blue"; our $holding3 = "yellow"; for (my $count = 3; $count >= 1; $count--) { print do {no strict 'refs'; ${"holding$count"}}, "\n"; }

Replies are listed 'Best First'.
Re^2: unsure how to use variable
by Your Mother (Archbishop) on Feb 18, 2012 at 06:11 UTC

    I know you're just doing your schtick and it’s nice to present a literal answer. Can’t -- that. Still, many, if not most beginner/self-taught hackers arrive at the symbolic references approach on their own. I did and it cost me plenty; slowed me down tremendously for the first year I was slinging Perl and made my code a hateful mess 5 times the size it should have been.

    So, I attach that for the OP. This works. The other suggested approaches are a better way to get your head in the game.