Rob Dixon wrote:
> John W. Krahn wrote:
>>
>> Rob Dixon wrote:
>>
>>> If you miss out the comma with
>>>
>>> print $1 "\n"
>>>
>>> then Perl looks at this as a method call on $1 as an IO::Handle
>>> object, or
>>>
>>> $1->print("\n");
>>
>>
>> No.
>>
>> perldoc -f print
>> print FILEHANDLE LIST
>> print LIST
>> print Prints a string or a list of strings. Returns true if
>> successful. FILEHANDLE may be a scalar variable name,
>> in which
>> case the variable contains the name of or a reference
>> to the
>> filehandle, thus introducing one level of indirection.
>>
>> If the comma is missing then the first scalar or bareword argument is
>> treated
>> as a filehandle.
>
> Hmm. Well if I was wrong I'd like to be corrected, but it certainly
> /looks/ and
> /behaves/ like indirect-object method call syntax, and the equivalent arrow
> syntax works and does the same thing. But whether it's really a method call
> under the hood I'm not absolutely certain, especially when there are
> oddities like
>
> print(STDOUT "text\n");
>
> working fine. Whatever it is, it certainly stops being either a list
> operator or a function call, so what else can it be?
So you are saying that everytime print() is used IO::Handle gets sucked in
somehow? And how would this have worked in Perl1 through Perl4 before OO was
added?
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>