Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Creating array name by susbtituting string

by kcott (Archbishop)
on Sep 12, 2017 at 10:00 UTC ( [id://1199186]=note: print w/replies, xml ) Need Help??


in reply to Creating array name by susbtituting string

"Is it possible"

While it's possible, it's almost certainly a really bad move.

You really need to show the context of what you're hoping to achieve. If you do that, you can probably get a much better answer. Perhaps consider writing something like this:

my %isis_adjacencies; for my $R2 (@array) { push @{$isis_adjacencies{$R2}}, $R2; }

Here's the net effect of doing something like that:

$ perl -MData::Dump -e 'my %x; my @y = qw{a b c}; push @{$x{$_}}, $_ f +or @y; dd \%x' { a => ["a"], b => ["b"], c => ["c"] }

It seems unlikely that's what you want; however, in the absence of more information, I can but guess.

See "perlref: Symbolic references" for more on what you're currently trying to do, why not to, and how to avoid doing it accidently by using the strict pragma (which you should be using anyway).

— Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1199186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found