in reply to Re: please explain print/say behavior with setlocale
in thread please explain print/say behavior with setlocale

This is where I got stuck. Why
$n = 1 / 2; print $n . "\n"; # 0,5 is different to print 1/2 ."\n"; # 0.5

Replies are listed 'Best First'.
Re^3: please explain print/say behavior with setlocale
by almut (Canon) on Mar 30, 2010 at 11:59 UTC

    See my update as to compile-time vs. run-time.  IOW, when you write

    BEGIN { setlocale LC_NUMERIC, "german"; } $n = 1 / 2; print $n . "\n"; # 0,5 print 1/2 ."\n"; # 0,5

    you get localized output in both cases, because localization is already in effect at compile-time.

      Using BEGIN block is very cool solution for this problem. Thank you very much. Would you say missing German localization without a BEGIN block is a bug or intended behavior for advanced usage?