This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Perl should have a print operator
=head1 VERSION
Maintainer: Jon Ericson <[EMAIL PROTECTED]>
Date: 5 August 2000
Last-Modified: 17 August 2000
Version: 2
Mailing List: [EMAIL PROTECTED]
Number: 39
=head1 ABSTRACT
Perl supplies an operator for line input - angle brackets. This is no
analogous operator for output. I propose "inverse angle brackets":
>"Print this line.\n"<;
=head1 DESCRIPTION
=head2 Easy things should be easy
Output is already easy in Perl, but it could be easier.
=head2 Symmetry
readline is to angle brackets as print is to inverse angle brackets.
C++ uses >> for input and << for output. Perl uses <> for input and ><
is for output. I sometimes see C<< print ">$x<\n"; >> used as a
debugging tool.
=head2 Perl Golf and JAPHs
perl -e 'print "Just Another Perl5 Hacker"'
perl -e '>"Just Another Perl6 Hacker"<'
perl -e '><><' # cat(1)
perl -e 'while(<>){>< if /^=head1/)' # Print the pod section titles
=head2 Other symbols
The only comment this RFC has had so far is "Ick!" -- Jonathan Scott
Duff <[EMAIL PROTECTED]> I agree - inverse angle brackets won't
improve Perl's reputation as an ugly language. Maybe I will get used to
them (and if I won't no-one will). Or maybe not. Perhaps the print
operator should be:
p(LIST)
so that other delimiters could be used. Or we could hijack:
?LIST?
=head1 IMPLEMENTATION
Let:
>LIST<
be equivalent to:
print(LIST)
Output always goes to the default output channel. (print is still there
if you want it.)
Note the ambiguous cat(1) example above. Are there other potential
problems parsing this print operator?
=head2 Migration from Perl 5
Inverse angle brackets are currently a syntax error, so no translation
will be needed.
=head1 Changes
=over
=item v2
Changed title
Added other symbols section
Added migration section
Added RFC 51 reference
=back
=head1 REFERENCES
RFC 2: Request For New Pragma: Implicit
RFC 34: Angle brackets should not be used for file globbing
RFC 51: Angle brackets should accept filenames and lists
perlfunc/print
perlop/"I/O Operators"