develooper Front page | perl.perl5.porters | Postings from July 2019

[perl #134298] "say" docs misleading

Thread Previous
From:
Hauke D
Date:
July 20, 2019 07:55
Subject:
[perl #134298] "say" docs misleading
Message ID:
rt-4.0.24-14320-1563609351-602.134298-75-0@perl.org
# New Ticket Created by  Hauke D 
# Please include the string:  [perl #134298]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134298 >


Hi,

perlfunc says "`say LIST` is simply an abbreviation for `{ local $\ = 
"\n"; print LIST }`". If that were true, the output of the following two 
would be the same:

$ perl -MData::Dumper -E 'sub x{Dumper($\)}{local$\="\n";print(x())}'
$VAR1 = '
';

$ perl -MData::Dumper -E 'sub x{Dumper($\)}say(x())'
$VAR1 = undef;

So I think the documentation is incorrect. I always thought `say LIST` was 
simply an abbreviation for `print(LIST,"\n")` - at least that's how it 
behaves (it's not `print LIST, $\`, as a simple test shows).

$ perl -E '$\="y"; print "x"; say "z"'
xyz

Thanks, Regards,
-- Hauke D


Thread Previous


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