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

Two problems with >&

Johan Vromans
March 19, 2000 12:33
Two problems with >&
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About