in reply to Re^2: search and replace regex return value
in thread search and replace regex return value

Could it be a blessed object or something else?

I think the AM post is onto something, Devel::Peek shows that $CFG{target} has some magic of type PERL_MAGIC_uvar attached to it. Not being a Tk expert I can only guess that the magic is probably necessary to bind the value to the widget, but the fact that this causes $CFG{target} =~ ... to behave differently than usual smells like a bug to me. But if the app needs to work on a range of Tk versions, it looks like the workaround might be necessary.

Replies are listed 'Best First'.
Re^4: search and replace regex return value
by LanX (Saint) on May 07, 2017 at 16:23 UTC
    OK but

    > Workaround is simple  my $target = $CFG{target} ;

    Might not be enough in order to loose special flags.

    I'd cast explicitly to get a new value

     my $target = "" . $CFG{target} ;

    Unfortunately I can't test at the moment.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Sorry, I should have mentioned that I had tested it, and the AM's workaround does work, my $target = $CFG{target}; copies the value without the magic.