Tom Christiansen wrote:
> 
> >Not sure I agree with that.  I think one point of confusion / perceived
> >difference between filehandles, open(), and basically every other
> >builtin is that all the others *return* what you want.
> 
> tie and bless and chop and chomp also all act upon their argument(s).
> Just to name a few.  bless has the nice side effect of returning it,
> too, but the rest are probably subject to your confusion issue.

Point taken, I did actually think of most of these. The difference is
all of these return something still:

   $object  = tie %hash, $class;
   $chopped = chop($var);
   $chomped = chomp($var);
   $ref     = bless {}, $class;

Now, one could argue the following. You could spruce up open() so it
acted more like tie. I could see this adding a lot of functionality:

   $object  = open($fh, "<$filename") or die;
   
You could ignore the $object just like with tie (maybe in 90% of your
calls), but if you chose to use it you would have direct access to, say:

   $object->autoflush;
   $object->untaint;

Thus, you have the "same old open()" for those who like it, but with the
added functionality of generating a FileHandle-esque object.

-Nate

Reply via email to