Click here to get back home

Checking the Platform 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
Checking the Platform in Perl mariakvelasco 01-09-2008
Get Chitika Premium
Posted by mariakvelasco on January 9, 2008, 3:28 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 Jürgen Exner on January 9, 2008, 3:50 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
newbie Qs about platform-specific perl modules January 27, 2006, 12:32 pm
Professional IDE for a cross-platform Perl application June 29, 2006, 1:00 pm
Receiving snmp traps in perl on Win platform? June 2, 2008, 12:47 pm
About perl bug pattern checking program April 7, 2006, 1:33 am
Checking the syntax of Perl code May 18, 2007, 9:49 am
cross-platform shell scripts January 4, 2005, 8:56 am
Re: SvUOK always fails on 64bit platform November 23, 2007, 12:20 pm
SvUOK always fails on 64bit platform November 23, 2007, 2:57 am
path delimiter in windows platform("/" could change to "\"?) September 26, 2004, 12:10 pm
Any cross-platform function to obtain the machine name? June 12, 2007, 6:08 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap