Perl6::Say - Implements the Perl 6 say (print-with-newline) function
say
print
# Perl 5 code... use Perl6::Say; say 'boo'; # same as: print 'boo', "\n" say STDERR 'boo'; # same as: print STDERR 'boo', "\n" STDERR->say('boo'); # same as: print STDERR 'boo', \n" $fh->say('boo'); # same as: print $fh 'boo', "\n";
Implements a close simulation of say, the Perl 6 print-with-newline function.
Use it just like print (except that it only supports the indirect object syntax when the stream is a bareword). That is, assuming the relevant filehandles are open for output, you can use any of these:
say @data; say FH @data; say $fh, @data; FH->say(@data); *FH->say(@data); (\*FH)->say(@data); $fh->say(@data);
but not any of these:
say {FH} @data; say {*FH} @data; say {\*FH} @data; say $fh @data; say {$fh} @data;
In Perl 6, say @stuff is exactly equivalent to Core::print @stuff, "\n".
say @stuff
Core::print @stuff, "\n"
That means that a call to say appends any output record separator after the added newline (though in Perl 6, the ORS is an attribute of the filehandle being used, rather than a glonal $/ variable).
$/
The syntax and semantics of Perl 6 is still being finalized and consequently is at any time subject to change. That means the same caveat applies to this module.
None.
Damian Conway (damian@conway.org)
As far as I can determine, Perl 5 doesn't allow us to create a subroutine that truly acts like print. That is, one that can simultaneously be used like so:
say @data;
and like so:
say {$fh} @data;
Comments, suggestions, and patches welcome.
Copyright (c) 2004, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
To install Perl6::Say, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Say
CPAN shell
perl -MCPAN -e shell install Perl6::Say
For more information on module installation, please visit the detailed CPAN module installation guide.