nikmit has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys,
I am attempting to assign values to variables like this:
The result is that within the foreach loop all is good, but outside of it the variables are empty... I tried to useforeach (@tagvalue) { if ($_ =~ /([\w,_]+):([0-9]+)/) { ${$1} = $2; } else { die "Failed to assign value to $1\n"; } }
but get an error on execution: 'Can't declare scalar dereference in "our"'.our ${$1} = $2;
./headbang
Back to
Seekers of Perl Wisdom