in reply to Re: Re: Re: (jeffa) Re: 'print' puzzle
in thread 'print' puzzle

Ah, guess we we're talking about the same thing... I got confused when you said:
I can see that scanfile will see that it was called with "wantarray" But why does print think that's an indirect object...
But scanfile doesn't get treated as a subroutine at all, so I didn't understand where wantarrray comes in to play. See the second stanza below for what I thought you meant by indirect object...

I don't have an answer for you, but I have yet to find a print statement that Deparses differently depending on the outer parens. I think it might be a red herring, which is why I left them off in my previous example.

% perl -MO=Deparse -e 'print abc' print abc $_; % perl -MO=Deparse -e 'print(abc)' print abc $_; # when you said 'indirect object' I thought this was # what you thought was going on.... % perl -MO=Deparse -e 'print abc def' print 'def'->abc; % perl -MO=Deparse -e 'print(abc def)' print 'def'->abc; % perl -MO=Deparse -e 'open abc; print abc def' open abc; print abc 'def'; % perl -MO=Deparse -e 'open abc; print(abc def)' open abc; print abc 'def'; % perl -MO=Deparse -e 'print abc:: def' print abc 'def'; % perl -MO=Deparse -e 'print(abc:: def)' print abc 'def'; % perl -MO=Deparse -e 'print abc:: ()' print abc (); % perl -MO=Deparse -e 'print(abc:: ())' print abc (); % perl -MO=Deparse -e 'print abc::def ()' print abc::def (); % perl -MO=Deparse -e 'print(abc::def ())' print abc::def ();

-Blake