[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: print $fh; how is this supposed to work?



At 21.55 -0500 2000.01.27, Jeff Pinyan wrote:
>The 5.005_02 docs on print() lead me to believe that:
>
>  $fh = \*FH;
>  print $fh;
>
>should print $_ to the filehandle referenced in $fh.  But it prints $fh
>instead.  Is this expected?

It depends on who you are.  :-)  When you are using implied objects and
indirect objects together, things get difficult.

(Note that I am speaking of grammatical objects, not programmatical objects.)

When you are talking about the 5.005_02 docs, what specifically are you
referring to?  I'd guess you mean that "print FILEHANDLE LIST" and "if LIST
is omitted then $_ is printed" leads you to believe it.  But there is also
"print LIST" syntax, of course.

So does the phrase "bring me" mean "bring me to the car" or "bring (to) me
the car"?  Without additional help, we need to guess.  Welcome to natural
language.  ;)  I think perl guesses right; without additional help, we
assume that "me" is the object, not the indirect object.  Likewise, $fh is
assumed to be the object of print, not its indirect object.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


References to:
Jeff Pinyan <jeffp@crusoe.net>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]