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
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
Jon Ericson wrote:
I would want it to return @items:
@sorted = sort print @items;
I'd prefer a different name (tee?) and keep print as it is.
Pretty much all the stuff being discussed right now can be stuck in a
module:
package Print::Variations;
use Exporter;
@EXPORT =
Jon Ericson wrote:
I had considered this, but I don't want Yet Another Quote-like Operator
(YAQO). Perhaps I should just change this RFC to call for a built-in
tee operator:
push @lines, tee($_) for ;
I would vote strongly against a built-in "tee" operator.
You can achieve the same