in reply to How to remove all new line ?

How about?
use strict; my @all_data = <DATA>; # read all data into the array chomp @all_data; # get rid of the newlines in each element of th +e array print @all_data; # print the whole array __DATA__ 11111111111 222222222222 333333333 4444444444444
If your file is really huge you may run into memory problems as you keep it all in memory at the same time.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: How to remove all new line ?
by blazar (Canon) on Aug 19, 2008 at 10:57 UTC

    Which, incidentally can be done in one step:

    chomp(my @all_data = <DATA>);
    --
    If you can't understand the incipit, then please check the IPB Campaign.
      TIMTOWTDI++

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James