in reply to search and replace regex return value

Running your code with perl 5.20.2 Tk 804.032 on linux (debian 8) produces:

foobar expecting this message foo
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: search and replace regex return value
by haukex (Archbishop) on May 07, 2017 at 15:53 UTC

    I can reproduce with Perl 5.24.1 and Tk 804.033 on Ubuntu. The output of the program after two button clicks is:

    foobar foo foo foo

    Which is strange, since ... =~ s/// is supposed to return the number of substitutions made, and clearly there's one being made here.

    But as I said here, inspecting things with Devel::Peek shows that $CFG{target} appears to have PERL_MAGIC_uvar magic attached to it, so I guess that's causing this strange behavior (haven't yet investigated further).