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

Two problems with >&

From:
Johan Vromans
Date:
March 19, 2000 12:33
Subject:
Two problems with >&
Message ID:
14549.14751.96503.587431@phoenix.squirrel.nl
1. When dup-ing a filehandle something strange happens:

    open (f1, ">foo1");
    open (f3, ">&f1");
    print f1  ("Hello");
    print f3  ("world\n");

   The output file contains "world\nHello" instead of "Helloworld\n".

2. This seemed straighforward to do:

    my $f1; my $f3;
    open ($f1, ">foo1");
    open ($f3, ">&$f1");
    print $f1  ("Hello");
    print $f3  ("world\n");

   However, the second open fails with 'Invalid argument'.

-- Johan



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About