[Chicago-talk] OPEN() conditional

Randal L. Schwartz merlyn at stonehenge.com
Wed Jul 6 07:16:56 PDT 2011

>>>>> "tiger" == tiger peng <tigerpeng2001 at yahoo.com> writes:

tiger> The empty string does work.
tiger> ...
tiger>                If FILEHANDLE is an undefined lexical ("my")
tiger>                variable the variable is assigned a reference to a
tiger>                new anonymous filehandle, otherwise if FILEHANDLE
tiger>                is an expression, its value is used as the name of
tiger>                the real filehandle wanted.  (This is considered a
tiger>                symbolic reference, so "use strict 'refs'" should
tiger>                not be in effect.)
tiger> ...
tiger>                Open returns nonzero upon success, the undefined
tiger>                value otherwise.

The empty string is invoking the second part of that paragraph, using a
symbolic filehandle.  Add "use strict", and it will fail.

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion

More information about the Chicago-talk mailing list