Pathologically Eclectic Rubbish Lister | |
PerlMonks |
loop to allocate values to variablesby travisbickle34 (Beadle) |
on Aug 17, 2005 at 14:49 UTC ( [id://484455]=perlquestion: print w/replies, xml ) | Need Help?? |
travisbickle34 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I have a long list of variables to which I want to allocate values. The values to be allocated populate a hash and the keys of the hash are the variable names preceeded by an underscore. i.e. the variable $blastresult needs to be allocated the value accessed by $$self{_blastresult} There are around 20 variables in all so I would like to allocate the values in some sort of foreach loop. For example, using 2 variables for simplicity's sake I would like to do something like: foreach my ($blastresult, $value) {$_ = $$self{_$_};} I can see the reasons why this particular code won't work, but can't see how I can fix it! Any help would be appreciated. Cheers in advance, TB34
Back to
Seekers of Perl Wisdom
|
|