in reply to
Re^9: perl 5.12 BSD portability (CPAN test result)...print
in thread perl 5.12 BSD portability (CPAN test result)...print
You mean like this:
perl -e 'use P;
P $y,"through STDOUT=%s", $x'
What it can't easily do is, both:
P STDOUT $x #without the comma
where $x is not an object.
That takes "special parsing"...but if the right prototype element was created to do that.. if not an object, then pass as a scalar), that would work too. I.e. I can get the 2nd case to work, but then the 1st case doesn't.
So is the only reason print has to be an operator is to handle printing to a <FH> w/o the comma, since the first case -- telling the difference between "$X" as a var and $x as a FH is fairly straightforward.
Note -- if you really wanted to print FROM file handle
"$x", I'd have to add code for that...but if the file is open for READ/WRITE -- no way to tell.
FWIW, P does print from File handles (but not as the first arg or w/o a format statement). It reads the file handle and prints the contents as part of the output:
# perl -e 'use P;
P \*STDOUT, "Input was: %s", \*STDIN;
Input was: <*=my input