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 Aug 2000 Last Modified: 20 Sept 2000 Mailing List: [EMAIL PROTECTED] Number: 39 Version: 4 Status: Retracted =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 NOTES ON RETRACTION It seems that I am alone in loving the proposed syntax. It's short, it works the way I want, it fits into my brain. As a matter of fact, I've found myself trying to use it in code that I am currently working on. But this RFC suffers a fatal flaw - perl already has a perfectly good print operator. Perl is a language designed to be spoken by people, so it should be comfortable to people (even if they don't think exactly like me :). =head1 DESCRIPTION =head2 Easy things should be easy Output is already easy in Perl, but it could be easier. For one thing, it doesn't nest well in statements: while (<>){ print; push @line, $_; }; This could be written: push @line, >$_< while <>; Printing to STDOUT and some other file ala tee(1): print $fh >"This also goes to stdout.\n"<; Another problem with print is that the ()s are optional. perlop points out the following traps: print $foo, exit; print ($foo & 255) + 1, "\n"; They could be correctly written as: >$foo<, exit; >($foo & 255) + 1, "\n"<; =head2 Ugly as a virtue A representative comment of this RFC is "Ick!" -- Jonathan Scott Duff <[EMAIL PROTECTED]> This RFC doesn't mind (nor does its maintainer). The print operator should be quick and dirty - used as an afterthought or side-effect. When you are looking for it, the print operator should stick out. When you are looking for something else (and have gotten used to the syntax), it should blend into the sea of punctuation. Do you remember when you first saw <FH>, or i++ (in C)? Compact syntax with side-effects, such as the print operator, should be ugly. This operator _will_ be misused, just as `STRING` (qx/STRING/) is misused. It will cause confusion just as the conditional operator (?:) causes confusion. It will be as jarring as =~ is to those who have never seen it. Perl is operator rich whether you like it or not. =head2 print will still be there Not all output is suited for inverse angle brackets. Most output will still go through print. Prints to files should use 'print FH LIST' so that the return value can be checked (and the filehandle specified). Long documents should be printed with the expanded form on their own lines so that they are emphasised. 'print "Hello world\n";' should remain the canonical 'first Perl script'. We still need print for practical and stylistic reasons. =head1 IMPLEMENTATION Let: >LIST< print LIST to the default output filehandle (normally STDOUT) and return LIST. It should have the same precedence as other list operators =head2 Migration from Perl 5 Inverse angle brackets are currently a syntax error, so no translation will be needed. =head1 Changes =over =item v4 Retracted =item v3 Added "Developing" status Operator now returns its arguments Changed DESCRIPTION to respond to concerns voiced about previous versions =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 perlop perlfunc/print perldebug/"Debugger Commands"/{p,x}