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

Re: read file into 1 line string

by trizen (Hermit)
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, <>; };

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966364]
shmem sprinkles naga bih jolokia powder over the cookies on the platter on the sideboard
mr_mischief grabs a spicy cookie.
[mr_mischief]: mmm.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-04-27 15:25 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (508 votes). Check out past polls.