Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have tried all the ways to remove the new line character at the end of the line and store it in a single. Please tell me what is wrong in the above code. But no luck#!/usr/bin/perl use strict; use warnings; while (<DATA>) { chomp $_; if($_ !~ /^{/){ $_ =~ s/\s+//gi; $_ =~ s/\n//gi; $_ =~s/\r//gi; print "$_\n"; } } __DATA__ {AUTHOR} author1 staff1 {HEADLINE} DISPOSABLE DECOR: THE CUTTING EDGE DULLS FAST\ STYLE AT A SPEED USUALLY ASSOCIATED WITH WARDROBE ITEMS.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remove line feed at the end
by hda (Chaplain) on Aug 15, 2009 at 11:12 UTC | |
by Anonymous Monk on Aug 15, 2009 at 12:18 UTC | |
by linuxer (Curate) on Aug 15, 2009 at 12:51 UTC | |
by Anonymous Monk on Aug 15, 2009 at 13:52 UTC | |
by ig (Vicar) on Aug 15, 2009 at 16:27 UTC | |
by Anonymous Monk on Aug 15, 2009 at 14:14 UTC | |
|
Re: remove line feed at the end
by bichonfrise74 (Vicar) on Aug 15, 2009 at 16:57 UTC | |
|
Re: remove line feed at the end
by sanku (Beadle) on Aug 26, 2009 at 04:14 UTC |