Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: read file into 1 line string

by trizen (Friar)
on Apr 21, 2012 at 14:24 UTC ( #966364=note: print w/ replies, xml ) Need Help??


in reply to read file into 1 line string

my $string = do { local @ARGV = $filename; join q{ }, grep $_ ne "\n" && chomp, <>; };


Comment on Re: read file into 1 line string
Download Code
Re^2: read file into 1 line string
by hperange (Beadle) on Apr 21, 2012 at 14:48 UTC
    Nice solution :)

    Althrough I think it would not give the desired output for an input file like this:

    xxxxxxx xxxxxxxx xxxxxxxxx xxxxxx

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-09-18 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (127 votes), past polls