Click here to get back home

problem with a script in 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
problem with a script in perl. Andre 07-07-2004
Get Chitika Premium
Posted by Andre on July 7, 2004, 2:21 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

Posted by Joe Smith on July 7, 2004, 6:58 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
Problem in passing values to perl script using another perl script August 10, 2005, 12:32 pm
ftp perl script problem.. June 6, 2006, 12:27 am
Problem in the Perl script March 28, 2007, 2:04 pm
Perl script timeout problem February 17, 2005, 10:53 am
Problem with perl script and form July 28, 2006, 6:01 pm
Problem with perl script and form July 28, 2006, 6:01 pm
problem in calling program in my perl script June 20, 2006, 9:55 am
Image::Magick and perl script STDOUT problem July 20, 2005, 10:05 am
Problem running "cvs commit -m" inside a Perl script October 2, 2006, 12:11 pm
Problem with my perl script - old records getting over written by new $completedData September 15, 2007, 10:56 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap