in reply to Remove new line characters from PCL file
Or if you really want to slurp the whole file at once:while (<$FILE>) { chomp; $var .= $_; }
Depending on the structure of the file, you may want to concatenate or join with a space to avoid running the lines into each other.$var = join '', map {chomp; $_} <$FILE>;
Update: added the slurp solution.
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
|
|---|