bh_perl has asked for the wisdom of the Perl Monks concerning the following question:
I have a data as below:-
Then I want to remove all new line from the data and become one line, the output must be :-11111111111 222222222222 333333333 4444444444444
Anyone could help me ?111111111112222222222223333333334444444444444
open (DATA, "$tmpfile"); while (my $data = <DATA>) { chomp($data); $data =~ s/\n+//g; #tr/\x0a\x0d//d; #s/\n//g; print "$data\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to remove all new line ?
by GrandFather (Saint) on Aug 18, 2008 at 02:00 UTC | |
|
Re: How to remove all new line ?
by ysth (Canon) on Aug 18, 2008 at 01:51 UTC | |
|
Re: How to remove all new line ?
by CountZero (Bishop) on Aug 18, 2008 at 05:55 UTC | |
by blazar (Canon) on Aug 19, 2008 at 10:57 UTC | |
by CountZero (Bishop) on Aug 19, 2008 at 15:56 UTC | |
|
Re: How to remove all new line ?
by JavaFan (Canon) on Aug 18, 2008 at 10:26 UTC | |
by axeman (Initiate) on Aug 18, 2008 at 23:48 UTC | |
| |
by blazar (Canon) on Aug 19, 2008 at 10:55 UTC | |
by JavaFan (Canon) on Aug 19, 2008 at 11:22 UTC | |
|
Re: How to remove all new line ?
by Anonymous Monk on Apr 15, 2019 at 11:26 UTC |