Click here to get back home

Perl routine for cluster detection

 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
Perl routine for cluster detection vincent64@yahoo.com 04-28-2007
Get Chitika Premium
Posted by vincent64@yahoo.com on April 28, 2007, 1: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 Mirco Wahab on April 29, 2007, 5:04 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
perl and eof detection October 5, 2007, 9:37 am
Web Forms / Perl / SPAM detection May 3, 2007, 9:40 am
Re: Web Forms / Perl / SPAM detection May 4, 2007, 2:41 pm
File::Find and error detection November 25, 2008, 2:54 am
Regex and detection on dhcpd.conf file April 12, 2005, 1:50 am
Problems with Device::SerialPort (Modem Carrier Detection) December 8, 2005, 11:25 pm
Sub routine location December 28, 2005, 6:29 am
carrying over an array from sql into another sub-routine May 10, 2005, 1:06 pm
accessing arrays in a different sub-routine March 28, 2005, 12:21 pm
Return a hash from a sub routine January 10, 2006, 2:36 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap