Click here to get back home

how to "spell out" the elements in a scalar variable?

 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
how to "spell out" the elements in a scalar variable? minjie 05-23-2005
Get Chitika Premium
Posted by minjie on May 24, 2005, 7:35 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 A. Sinan Unur on May 25, 2005, 5:21 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
Can not add a scalar variable of path into @INC? May 8, 2007, 10:52 pm
assigning array to a scalar variable March 14, 2008, 4:39 am
understading double scalar variable $$ July 17, 2008, 7:55 pm
Spell check French in perl September 19, 2004, 2:39 pm
set a variable with a specified element of an array...and all elements that follows February 16, 2007, 3:06 am
Hash keys to scalar variable conversion. May 18, 2006, 4:41 pm
Scalar variable in void context before a loop October 20, 2008, 1:49 am
spell checking...capitalization of proper names July 28, 2007, 7:54 am
Spell checking an html file with aspell or ispell September 2, 2007, 8:58 am
Slice returned hash or access to its elements without assigning to a variable June 11, 2005, 10:35 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap