develooper Front page | perl.perl5.porters | Postings from March 2000

Filehandle name / use strict clash

Johan Vromans
March 19, 2000 12:33
Filehandle name / use strict clash
Message ID:
Functions like 'print' have in their documentation:

    FILEHANDLE may be a scalar variable name, in which case the
    variable contains the name of or a reference to the filehandle,
    thus introducing one level of indirection.

However, the 'variable contains the name' variant is rejected when the
strict pragma is in effect (Can't use string ("F1") as a symbol ref
while "strict refs" in use):

    open (F1, ">foo1");
    my $f1 = "F1";
    print $f1 ("Hello");

I could not find this anywhere in the documentation, at least not in
the obvious places like with 'print' and friends.

-- Johan Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About