in reply to How to get a reference from an eval() string?

Why don't you put the whole assignment to eval?
eval "$base\{$lastPart} = \$newData"

But you can return a reference to the value to be able to change it:

my $ref = eval "\\$base\{$lastPart}" || eval "$base = {}"; $$ref = $newData;

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: How to get a reference from an eval() string?
by exilepanda (Pilgrim) on Sep 06, 2016 at 10:15 UTC
    Oh! Stupid me... eval "$base\{$lastPart} = \$newData" This works!! BIG THANKS!!

    Seems my focus really draw to know how to get the reference deep in my heart.... rather than how to get this work done...

    But for the $$ref part, because I don't know what exactly the data type will be on the sub return side, either the assignment side, so that can be a %$ref, @$ref or $$ref etc. If I don't take care of it per case, I probably get sort of Not a XXXXX reference error.

      Beware the XY Problem. It's a common one in software fora.

        Confess that I might probably asking Y, but no regret. For resolving X, I believe TIMTOWTDI, and mostly for 1 time only. But Y is most likely a reusable skill in the long run (at least for me). Thanks for your echo though. =)