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

[perl #134298] "say" docs misleading

Thread Previous
Hauke D
July 20, 2019 07:55
[perl #134298] "say" docs misleading
Message ID:
# New Ticket Created by  Hauke D 
# Please include the string:  [perl #134298]
# in the subject line of all future correspondence about this issue. 
# <URL: >


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"'

Thanks, Regards,
-- Hauke D

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About