in reply to dynamically created variables

Of course you can create variables on the fly:
#use strict; #use warnings; my $counter = 0; while (<DATA>) { eval "\$a" . $counter++ . " = '$_';"; } print "$a0 $a1 $a2"; __DATA__ line 1 line 2 line 3

rdfield

Replies are listed 'Best First'.
DO NOT DO THIS AT HOME
by dragonchild (Archbishop) on Sep 19, 2003 at 13:59 UTC
    DO NOT DO THIS

    This method is called "soft references". It is a capability of Perl, but there are very few reasons to actually use it. In nearly every isntance, hashes are much better, safer, and cleaner. There are many reasons why soft references don't compile under strict. Unless you know exactly why you shouldn't use soft references, DON'T USE SOFT REFERENCES!

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.