On Mon, Jan 05, 2015 at 02:25:15PM +0100, Hans Ginzel wrote:
> Hello!

Hello,

> Is correct that say() uses "n"? Why it does not use $\
> (http://perldoc.perl.org/perlvar.htm#$OUTPUT_RECORD_SEPARATOR)?
> See http://perldoc.perl.org/functions/say.html. Consider Perl6::Say -
> http://rpm.pbone.net/index.php3/stat/45/idpl/1146707/numer/3/nazwa/Perl6::Say#lbAE.
> What about say() on Mac or Windows?

According to perldoc -f say:
> Just like "print", but implicitly appends a newline. "say LIST"
> is simply an abbreviation for "{ local $\ = "\n"; print LIST
> }".

print() already uses $\ so if that's all say() did it would have
no effect. Instead, say() temporarily sets $\ to "\n" before
printing so that the "record" ends with a newline.

If you want to use $\ instead of "\n" then you can just use print
normally.

use strict;
use warnings;

$\ = "--->";

print for qw/foo bar baz/;

__END__

Output:

foo--->bar--->baz--->

Regards,


-- 
Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

Attachment: signature.asc
Description: Digital signature

Reply via email to