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

Re: Array loops and assignments (symbolic references)

by LanX (Canon)
on Jul 07, 2013 at 18:37 UTC ( #1042997=note: print w/ replies, xml ) Need Help??


in reply to Array loops and assignments

Thats a FAQ and IMHO 99% of the cases of assignments to symbolic references in Perl are a result of weak code design (sorry!)

the following works under no strict 'refs'

DB<109> $var="var";$id=0 => 0 DB<110> ${$var.$id}=42 => 42 DB<111> $var0 => 42

Are you sure you need that? Be warned about the consequences!

Older discussions regarding 'no strict refs' might help you getting an insight why.

edit

Are you aware of the concept of hashes?

Cheers Rolf

( addicted to the Perl Programming Language)


Comment on Re: Array loops and assignments (symbolic references)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-10-26 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (151 votes), past polls