in reply to How to slurp files and join lines

chomp(@slurp = <>); print @slurp;
Alternatively,
$text = do { local $/; <>}; $text =~ s/\n//g; # for some \n print $text;
Update: I guess I should add perldoc -f chomp since you obviously didn't know that chomp already works on a list of values.

Replies are listed 'Best First'.
Re^2: How to slurp files and join lines
by fishbot_v2 (Chaplain) on May 26, 2005 at 16:34 UTC

    And a requisite, ill-advised and derivative one-liner:

    my $slomped = join "", do { local $/; <>} =~ m/([^\n]+)/g;

    It's slower, messier, and hard to read. On the plus-side, I'd like to coin the term 'slomped'.

      That's ok, if you allow me to claim to the term "chumped" ;-)


      Remember rule one...