in reply to generating variable names

It sounds like you're asking about symbolic references. You can use symbolic references, but there are a lot of disadvantages associated with using them.

I think a better way of approaching such a problem would be to use an array or a hash. Something like this:

my @blah = qw/foo bar baz/; # where you would have accessed "blah" . $i, you can # now access $blah[$i] instead for my $i (0..$#blah) { print $blah[$i], "\n"; } # or you can just foreach foreach my $thing (@blah) { print $thing, "\n"; }