I would like to declare variables recursively, this way I could save lots of time in associating data of arrays hashes etc. What I would like to to is the following: foreach $name (@array){ ${$name}=X } is it possible con perl?, because its posible with linux shell. Thanks
takes only a few more keystrokes... (well, actually less, but that's only because I used for as a statement modifier.)$hash{$_} = X for @array;
In particular there are tons of mails/posts/nodes/articles explaining why it is generally recommended not to use symrefs, which is also the reson why they're ruled out by use strict; (hey, you're using it, aren't you?)
In reply to Re: Declaring variables recursively
by blazar
in thread Declaring variables recursively
by sciarnold
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |