If by "second assignment" you mean my $pvar = ${ $name . "::VAR" };, all you've done is create a new lexical scalar with the value contained in the package variable $pkg2::VAR. There's nothing tying this new variable back to $pkg2::VAR.
If that's what you wanted you'd either need to have a scalar reference my $pvar = \${ $name . "::VAR" };" and use that (${ $pvar } = 22), or make an alias to the original variable (local *pvar = \${ $name . "::VAR" }; $pvar = 22;).
The cake is a lie.
The cake is a lie.
The cake is a lie.