It is initially assigned as a scalar variable:
... if( $count eq 1 ) { ... $key = $keyGlobal; } else { ... $key = $keyFed; } ...
Then, later on, the same variable name ("key") is used as a hash:
if( $fileline =~ "..." && $found eq 0 ) { $key{'/Repo Version'} = "$1"; $found = 1; }
If the initial assignment to "$key" was intended to be a reference to a hash, then assigning a value to an element of the hash requires the use of a de-reference operator, like this:
Since your original code did not use de-reference, your assignment of "$1" to "$key{'/Repo Version'} caused a new hash array to be declared at that point -- note that when the same name is used for a scalar and a hash (and/or an array), Perl treats the scalar and the hash (and/or the array) as different storage locations, whose values are completely distinct and unrelated.$key->{'/Repo Version'} = $1;
In reply to Re: Adding values to registry
by graff
in thread Adding values to registry
by spacejunky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |