Tom Christiansen wrote:
> Perl already *has* a print operator: "print". :-)

I think what I really want is a tee operator.
 
> The problem with what you have there is that it hides the act of
> output within an arbitrarily long circumfix operator whose terminating
> portion is potentially very far away.  What's wrong with putting a
> command name at the start of a command, anyway?  Note that the
> readline operator is not normally subject to this same problem
> as its operand is a handle, not a long string.

I would consider this to be bad style:

  >qq{
  ...
  }<; # yuck!

This is what I'd consider good style:

  my @output =
     map { $_->[0] }
     sort { $a->[1] cmp $b->[1] }
     map { [>$_<, expensive_func($_)] } # print original lines
     <>;

(Modified from <http://www.perlmonks.org/index.pl?node_id=9108>)

The main point of this statement is the Schwartzian Transform, but it
also prints the original lines en passant.  

> Also, it makes it icky to quote Perl code in mail messages;
> see above. :-(

Agreed.  Good style would avoid this problem.  The example in the
synopsis of this RFC should be:

  my $output = >"Print this line.\n"<;

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King

Reply via email to