Click here to get back home

use warnings; and use Warnings; give different results

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
use warnings; and use Warnings; give different results Ted Sung 08-30-2004
Get Chitika Premium
Posted by Ted Sung on August 30, 2004, 2:09 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by Sherm Pendley on August 30, 2004, 7:22 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
unicode: equal strings give different results? September 28, 2004, 12:56 am
warnings or -w ? November 5, 2006, 7:24 am
perl warnings October 10, 2004, 8:36 pm
Why aren't 'warnings' on by default? February 5, 2005, 2:19 am
Where are the warnings "keywords"? March 13, 2005, 3:00 pm
Can't locate warnings.pm in @INC October 10, 2005, 10:37 am
Warnings in program December 7, 2005, 7:54 am
warnings dilemma May 10, 2007, 12:28 pm
use warnings and -w behaviour May 11, 2007, 3:32 pm
checklink - perl warnings October 7, 2004, 6:37 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap