[32841] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4107 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 1 21:09:30 2014

Date: Wed, 1 Jan 2014 18:09:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 1 Jan 2014     Volume: 11 Number: 4107

Today's topics:
    Re: Question about language setting <rweikusat@mobileactivedefense.com>
    Re: Syntax understanding problem <rweikusat@mobileactivedefense.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 01 Jan 2014 17:58:14 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Question about language setting
Message-Id: <87iou3y47d.fsf@sable.mobileactivedefense.com>

Keith Thompson <kst-u@mib.org> writes:

> Rainer Weikusat <rweikusat@mobileactivedefense.com> writes:

[...]

>> -----------
>> #include <locale.h>
>> #include <stdio.h>
>>
>> int main(void) {
>>     printf("%f\n",2.5);
>>     setlocale(LC_NUMERIC, "de_DE");
>>     printf("%f\n",2.5);
>>     setlocale(LC_NUMERIC, "C");
>>     printf("%f\n",2.5);
>>
>>     return 0;
>> }
>> -----------
>>
>> this should print (possibly with variations in the number of trailing
>> zeroes)
>>
>> 2.500000
>> 2,500000
>> 2.500000
>>
>> If it doesn't,

[...]

>> setlocale doesn't work as it is supposed to

[...]

> setlocale() returns a char* that's either a pointer to a string (if it
> succeeded), or a null pointer (if it failed).  It's probably worth
> adding code to check for this rather than just depending on the output
> of printf to change.  (On my system, the first setlocale() call fails
> because I don't have any German locales installed.)

Neither had I[*]. But

setlocale(LC_NUMERIC, "de_DE");

is supposed to switch to 'Germanly formatted numerals' (with apologies
to people who care about grammer :-) and if it can't because the
necessary information is not available, it didn't work as it was
supposed to.

[*] After a short and happy intermezzo in 1998/99, I've grudgingly come
to accept that there are two kinds of people on this planet:

	- those who write using Letters which is exactly everything
          available on a US-QWERTY keyboard

	- weird aborigines painting bizarre ideograms they attach some
          uninteresting meaning to we have to reproduce on computer
          displays to avoid alienating potential customers

and have henceforth dutifully restricted myself to ASCII in writing.


------------------------------

Date: Wed, 01 Jan 2014 17:09:22 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Syntax understanding problem
Message-Id: <87ppoby6gt.fsf@sable.mobileactivedefense.com>

Ben Morrow <ben@morrow.me.uk> writes:
> Quoth "Newsgroup only please, address is no longer replyable."  <bad@example.invalid>:
>> On Mon, 30 Dec 2013 17:44:47 +0000 in comp.lang.perl.misc, Rainer
>> Weikusat <rweikusat@mobileactivedefense.com> wrote,
>> >
>> >Ehh ... well ... ($a = 23) is obviously a list with a single elementy so
>
> This is incorrect. In an expression such as
>
>     ($a = 23) + 1
>
> the parenthesised part is not a list, it is a scalar.

It is a kind of term, an expression in parentheses, and it will be
interpreted based on its context. The +-operator enforces a scalar
context for both of its operands. But the result of

($a = 23) + 1

is really the same as the result of

($b = 24, $a = 23) + 1

Grammatically (5.10.1),

term    :       termbinop

[...]

        |       '(' expr ')'
                        { $$ = sawparens(IF_MAD(newUNOP(OP_NULL,0,$2), $2));
                          TOKEN_GETMAD($1,$$,'(');
                          TOKEN_GETMAD($3,$$,')');
                        }

expr    :       expr ANDOP expr

[...]


        |       argexpr %prec PREC_LOW

        
/* Expressions are a list of terms joined by commas */
argexpr :       argexpr ','

which is the 5.10.1 'list production'.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4107
***************************************


home help back first fref pref prev next nref lref last post