develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #103492] more documentation lies, plus The Unicode Bug *again*

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
January 1, 2012 00:21
Subject:
[perl #103492] more documentation lies, plus The Unicode Bug *again*
Message ID:
rt-3.6.HEAD-14510-1325406099-1343.103492-15-0@perl.org
On Sat Nov 12 15:51:48 2011, tom christiansen wrote:
> So it is into the next *argument*, not the next variable (or it would
> have found $count),
> which must be a scalar lvalue.

Fixed in commit e38523840.

> 
> Or something.  This it gets wrong:
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n That was %s
> chars.\n", "\xDF", 16, substr($count,-2), $count'
>     ß aged 16. That was like FF chars.
> 
> And no, it isn't order of evaluation:
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n", "\xDF",
> 16, substr($count,-2); printf " That was %s chars.\n", $count'
>     ß aged 16. That was like FF chars.

Fixed in commit 69974ce61.

> 
> That's just as wrong as:
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n That was %s
> chars.\n", "\xDF", 16, \$count, $count'
>     ß aged 16. That was like FF chars.
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n", "\xDF",
> 16, \$count; printf " That was %s chars.\n", $count'
>     ß aged 16. That was like FF chars.
> 
> But it's silent.  What gives?
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n", "\xDF",
> 16, ${ \$count }; printf " That was %s chars.\n", $count'
>     ß aged 16. That was 10 chars.
> 
> In fact, it doesn't squawk at all:
> 
>     % perl -lE '$count = "like FF"; printf "%s aged %d.%n", "\xDF",
> 16, \@count; printf " That was %s chars.\n", $count'
>     ß aged 16. That was like FF chars.

I doubt there’s anything that can be done about that.  It’s the same for
sub{ $_[0]=43 }->(...).

> 
> But that's nothing.  You probably didn't notice, but it's lying about
> "the
> number of characters output" so far.
> 
>     1% perl -le 'printf "%s aged %d.%n That was %d chars.\n",
> "Naivete", 16, ($count) x 2'
>     Naivete aged 16. That was 16 chars.
> 
>     2% perl -le 'printf "%s aged %d.%n That was %d chars.\n",
> "Na\xEFvet\xE9", 16, ($count) x 2'
>     Naïveté aged 16. That was 16 chars.
> 
>     3% perl -le 'printf "%s aged %d.%n That was %d chars.\n",
> "Nai\x{308}vete\x{301}", 16, ($count) x 2'
>     Naïveté aged 16. That was 20 chars.

Fixed in commit 89139cf8b.

> Count, damn it!  What good is a computer that can't count?

It won’t count. :-)

> So other than..., what is this %n thing *supposed* to be for?
> I really have no idea, considering that there are exactly zero
> examples
> of it in the documentation, at least that I could locate.

One could use it for indenting debugging output.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=103492

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About