Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

lexical vs. local file handles

by jo37 (Deacon)
on Apr 18, 2020 at 18:26 UTC ( [id://11115734]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open FH, '<', 'myfile';
    print FH, "something\n";
    
  2. or download this
    No comma allowed after filehandle at ...
    
  3. or download this
    open my $fh, '<', 'myfile';
    print $fh, "something\n";
    
  4. or download this
    open local *FH, '<', 'myfile';
    while (<FH>) {
        # do something
    }
    close FH;
    
  5. or download this
    #!/usr/bin/perl
    
    ...
    is \@bar, [$bar], 'good: got $bar';
    
    done_testing;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found