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
In reply to Variable scope headaches by nikmit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |