in reply to weird problem with macports perl on apple m1/m2 based system

I follow the sleuth of the anonymous monk: What does locale -k LC_NUMERIC say? Wild guessing, I know.

Update: From sprintf:

«If use locale (including use locale ':not_characters') is in effect and POSIX::setlocale has been called, the character used for the decimal separator in formatted floating-point numbers is affected by the LC_NUMERIC locale. See perllocale and POSIX.»

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^2: weird problem with macports perl on apple m1/m2 based system
by perltux (Monk) on Jun 12, 2023 at 12:35 UTC
    AFAIK, based on Tests on my Linux PC, to get LC_NUMERIC to influence the output of sprintf requires adding 'use locale;' (in addition to 'use POSIX;' or 'use POSIX qw(locale_h);') in the script.

    On my Linux PC I actually have a locale (de_DE) that uses comma as decimal point and dot as thousands separator and despite that it has no influence on the calculations in the test program or the original application.

    But since 'use POSIX;' also includes 'use POSIX qw(locale_h);' I have now modified my test script to use 'use POSIX qw(strftime);' instead of 'use POSIX;' and asked the Mac M1 user to download and run the test script again and based on his feedback it's still ignoring decimals in the multiplication, the output is still:
    12.99 16.25 192

      That would have been too nice if it had been this problem. Too bad. Good luck with the further research.

      «The Crux of the Biscuit is the Apostrophe»