in reply to Re (tilly) 1: auto-vivifying file handles
in thread auto-vivifying file handles

Using scalars for file handles without relying on auto-vivication: gotcha.

What does $self->{handle} have to do with my $handle ?

—John

  • Comment on Re: Re (tilly) 1: auto-vivifying file handles

Replies are listed 'Best First'.
Re (tilly) 3: auto-vivifying file handles
by tilly (Archbishop) on Sep 26, 2001 at 01:00 UTC
    Sorry for being unclear. My warning is that when you start using any old scalars as filehandles, people are likely to expect that you can use any construct that gives a scalar as a filehandle. Unfortunately this doesn't work.

    And a classic case that causes confusion comes when you put the handle in an object and then wonder why the obvious syntax doesn't work very well...

      Yea, I've hit that myself (not for files, though) where I forget that I'm implicitly omitting braces, and that only works on a simple scalar name.

      —John