Click here to get back home

com port

 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
com port Jeff Dieterle 06-10-2005
`--> Re: com port Josef Moellers06-10-2005
Posted by Jeff Dieterle on June 10, 2005, 9:49 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 Josef Moellers on June 10, 2005, 5:27 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
Socket Send and Receive, Same local port, Different Remote Port March 1, 2005, 12:35 pm
Serial Port programming - Reading DSR from port July 11, 2005, 2:29 pm
port 80 January 3, 2006, 7:28 pm
POE and Port Redirection September 17, 2004, 9:29 pm
OS/2 port of Perl 5.8 not adding CR to \n August 29, 2004, 2:06 pm
wildcard the port in bind January 18, 2005, 3:27 am
XP Serial port control December 30, 2005, 8:55 pm
two servers listening on same port ? June 19, 2006, 4:17 pm
Wrong Server Port February 14, 2007, 2:49 pm
Reading from a serial port March 10, 2007, 8:01 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap