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

Re: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };

by liz (Monsignor)
on Aug 29, 2003 at 14:51 UTC ( #287685=note: print w/ replies, xml ) Need Help??


in reply to Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };

I've ++ed this, but I wonder whether it isn't time to remove glob file handles from documentation and replace them with lexically bound file handles? Instead of:

open FILEHANDLE,'filename' or die "open of 'filename' failed: $!\n";
at least show the more modern idiom:
open my $handle,'<','filename' or die "open of 'filename' failed: $!\n +";
I realize the title is "Idioms explained", but you're also teaching people new idioms this way. So from a teaching point of view, I should at least mention that there is a new and better way of opening files since Perl 5.6.0 (if I'm not mistaken).

Liz


Comment on Re: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2015-07-05 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls