Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Is there a problem with using barewords as filehandles ?

by Discipulus (Abbot)
on Jul 01, 2020 at 10:19 UTC ( #11118756=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -we "use strict; open FH, '>', 'text.txt'; open FH, '>', 'text.tx
    +t';"
    
    perl -we "use strict; open my $fh, '>', 'text.txt'; open my $fh, '>', 
    +'text.txt';"
    "my" variable $fh masks earlier declaration in same scope at -e line 1
    +.
    
  2. or download this
    use strict;
    
    ...
    open FH, '<', 'filename'; # now ok
    open my $fh, 'filename';  # now ok
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118756]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2020-09-23 00:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (130 votes). Check out past polls.

    Notices?