in reply to Re: Create an array reference from a string
in thread Create an array reference from a string

So I guess you're suggesting something like:
my @bar = qw(One Two Three); my $foo = "bar"; my %quux = ("bar", \@bar); print "***" . $foo . "***"; foreach my $baz (@{$quux{$foo}}) { print $baz . "\n\n"; }
It looks like that will work, but it does mean I have to create a hash.

Replies are listed 'Best First'.
Re: Re: Re: Create an array reference from a string
by dragonchild (Archbishop) on Apr 12, 2004 at 19:44 UTC
    Think about it this way - you are asking to access some data structure (scalar, array, hash, whatever) using an arbitrary string as its name. That is the very definition of a hash.

    In fact, soft references are implemented under the hood as a hash. So, it's not like you're saving anything. :-)

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

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose