Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by chromatic (Archbishop)
on Sep 02, 2003 at 21:25 UTC ( #288445=note: print w/replies, xml ) Need Help??


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

Your first suggestion would seem to double the input record separator. Did you test it? Do you somehow have autochomp enabled?

#!/usr/bin/perl -w use strict; my $line = join $/, <DATA>; print "<<$line>>\n"; __DATA__ one two tie my shoe
  • Comment on Re: Re: Re: Perl Idioms Explained - my $string = do { local $/; <FILEHANDLE> };
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://288445]
help
Chatterbox?
NodeReaper puts the hammer down

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-09-21 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (250 votes). Check out past polls.

    Notices?