Click here to get back home

Serail Port communication using PERL

 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
Serail Port communication using PERL gunajoe@gmail.com 05-04-2006
Get Chitika Premium
Posted by gunajoe@gmail.com on May 4, 2006, 2:59 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 Jim Gibson on May 4, 2006, 2:32 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
Perl and C communication January 12, 2008, 12:24 pm
Communication between Cgi and another perl application December 13, 2004, 2:14 pm
googletalk communication with perl September 16, 2005, 8:34 pm
Bidirectional communication between Perl and C January 6, 2006, 2:36 am
Perl parent-child communication. April 24, 2007, 4:42 am
Client-Server Communication in Perl CGI November 14, 2008, 7:57 am
VB6 and Perl on 2000/XP: Req recommendation for interprocess communication June 4, 2005, 9:24 am
OS/2 port of Perl 5.8 not adding CR to \n August 29, 2004, 2:06 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap