in reply to Re^5: Change decimal point temporarily
in thread Change decimal point temporarily
Hm, It seems to work if you use locale:
Update: this does not work:perl -we 'use POSIX; use locale; setlocale LC_NUMERIC, "fr_FR"; $x = " +123,45"; $x+=0.1; print $x; setlocale LC_NUMERIC, ""; $x += 0.1; prin +t $x;'
So what I do now is to add 0 if it looks_like_number() and everything works fine. At least what I've tested until now...perl -we 'use POSIX; use locale; setlocale LC_NUMERIC, "fr_FR"; $x = " +123,45"; print $x; setlocale LC_NUMERIC, ""; $x += 0.1; print $x;'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: Change decimal point temporarily
by ikegami (Patriarch) on Aug 03, 2010 at 02:40 UTC |
In Section
Seekers of Perl Wisdom