in reply to Re: Using a Sub to pull info. from a Text File
in thread Using a Sub to pull info. from a Text File

Someone said on one of the other nodes today that DATA has a special meaning in Perl. In order to avoid name collisions ought not to call one's own filehandles DATA.

I do recall Larry Wall saying that the possibility of name collisions in Perl exists only with respect to filehandles. He said that one should always name one's filehandles using all uppercase letters. And apparently, in addition one should not name a filehandle DATA.

  • Comment on Re: Re: Using a Sub to pull info. from a Text File

Replies are listed 'Best First'.
(tye)Re: Using a Sub to pull info. from a Text File
by tye (Sage) on Apr 11, 2001 at 19:53 UTC

    That was here and it was wrong. The only reason to not use a filehandle of DATA is in case you will want to upgrade your script to have an __END__ section (or your module to have a __DATA__ section).

    So I agree that it is a good idea to not use DATA as a file handle, but I disagree that doing so will cause problems with the script (just potential maintenance problems).

            - tye (but my friends call me "Tye")
Re: Re: Re: Using a Sub to pull info. from a Text File
by suaveant (Parson) on Apr 11, 2001 at 16:32 UTC
    I've never had a problem using DATA as a filehandle.
                    - Ant