http://www.perlmonks.org?node_id=788849

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

#!/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.
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