Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Three argument version of open '>-' (updated)

by choroba (Cardinal)
on Mar 01, 2021 at 21:42 UTC ( [id://11128967]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open my $output, '>-' or die $!;
    
  2. or download this
    open my $output, '>&', *STDOUT or die $!;
    
  3. or download this
    open my $output, '>-' or die $!;
    close *STDOUT;
    print {$output} "This fails with Bad file descriptor";
    
  4. or download this
    open my $output, '>&', *STDOUT or die $!;
    close *STDOUT;
    print {$output} "This prints OK\n";
    
  5. or download this
    my $output = *STDOUT;
    
  6. or download this
    close STDOUT;
    print {$output}
        'Besides Bad file descriptor, this will also warn "print() on clos
    +ed filehandle STDOUT"';
    
  7. or download this
    #!/usr/bin/perl
    use strict;
    ...
    my $what = shift;
    my $code = $dispatch{$what} or die 'Not associated';
    test($code);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11128967]
Approved by LanX
Front-paged by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-05-29 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found