Click here to get back home

embedding the 'perl' (newbie)

 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
embedding the 'perl' (newbie) Mirco Wahab 09-26-2006
Posted by Mirco Wahab on September 26, 2006, 8:41 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 Ben Morrow on September 26, 2006, 5:30 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
Embedding the perl, part II October 1, 2006, 1:46 pm
perl embedding test fails on z/OS January 6, 2005, 10:53 pm
Problem when embedding 2 Perl interpreters in C++ July 11, 2006, 10:19 am
Embedding perl in shared libs November 22, 2006, 2:53 am
New article online: 'Embedding Perl in database tables' March 18, 2005, 5:31 pm
Embedding private .pm files into a script January 29, 2006, 2:47 pm
Perl newbie please help July 8, 2004, 2:31 pm
newbie: Perl IDE available?? February 27, 2005, 6:14 am
Newbie to Perl April 17, 2006, 6:13 am
perl newbie April 28, 2007, 11:50 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap