in reply to Re: Perl, Gtk2 and locale — a bit of a mess
in thread Perl, Gtk2 and locale — a bit of a mess

Once again IRC help, so for the sake of completeness I’m answering myself: the reason for the awkward difference is compile time optimisation. Where, in the first case, that last concatenation & stringification still happened during initial unset locale.

Note how the last two prints work as expected if one replaces the constant with a subroutine call.

~$ perl -E 'sub x { 3.14 }; use POSIX qw(setlocale LC_NUMERIC); say x; + setlocale(LC_NUMERIC, ""); say x; setlocale(LC_NUMERIC, "C"); say x; + setlocale(LC_NUMERIC, ""); say x; say x . ""; ' 3.14 3,14 3.14 3,14 3,14