http://www.perlmonks.org?node_id=983857

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:

foreach (@tagvalue) { if ($_ =~ /([\w,_]+):([0-9]+)/) { ${$1} = $2; } else { die "Failed to assign value to $1\n"; } }
The result is that within the foreach loop all is good, but outside of it the variables are empty... I tried to use
our ${$1} = $2;
but get an error on execution: 'Can't declare scalar dereference in "our"'.

./headbang