Click here to get back home

BEGIN { package Foo; use Foo }

 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
BEGIN { package Foo; use Foo } kj 12-24-2005
Posted by kj on December 25, 2005, 4:29 am
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 Eric J. Roode on December 25, 2005, 3:19 am
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
BEGIN <> BEGIN May 31, 2006, 5:32 am
Q on BEGIN and INIT April 19, 2005, 3:05 pm
Where to begin with Perl 6 September 5, 2005, 11:03 am
Nub question - were to begin? April 26, 2006, 2:33 pm
BEGIN, INIT etc... March 26, 2008, 3:22 pm
Should I use BEGIN, CHECK, or INIT? October 27, 2004, 8:32 pm
bless an object in a BEGIN block (Singleton) October 13, 2006, 3:02 am
BEGIN not safe after errors--compilation aborted February 22, 2008, 11:26 am
Regular expression to match any line that DOESN'T begin with a particular string March 22, 2006, 7:48 pm
file does not begin with '%PDF-' - Error when searching pdfs on FireFox browser August 2, 2006, 11:02 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap