Click here to get back home

FAQ 4.22 How do I expand function calls in a string?

 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
FAQ 4.22 How do I expand function calls in a string? PerlFAQ Server 08-20-2006
Get Chitika Premium
Posted by PerlFAQ Server on August 20, 2006, 3:03 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 Justin C on August 20, 2006, 5:52 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 brian d foy on August 20, 2006, 3: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 RedGrittyBrick on August 28, 2006, 6:19 am
Please log in for more thread options
brian d foy wrote:
> We fix this by getting many eyes, such as yours, to constantly
> scruntize the answers and to update them where appropriate.

I'm confused ...

Just how many eyes does Justin have?

Please don't scruntize the answers, I like them unscrunted!

If Justin is constantly scruntizing, he has no time to eat, shower etc?
I think he should scruntize for no more than 8 hours a day, not constantly.

How do you get eyes to update the answers? Does Justin wear a special
hat for this? Are laser beams involved?

Similar ThreadsPosted
FAQ 4.22: How do I expand function calls in a string? December 8, 2004, 6:03 am
FAQ 4.22 How do I expand function calls in a string? February 2, 2005, 6:03 pm
FAQ 4.22 How do I expand function calls in a string? April 23, 2005, 11:03 pm
FAQ 4.22 How do I expand function calls in a string? July 9, 2005, 4:03 am
FAQ 4.22 How do I expand function calls in a string? August 22, 2005, 4:03 am
FAQ 4.22 How do I expand function calls in a string? December 21, 2005, 5:03 pm
FAQ 4.22 How do I expand function calls in a string? April 14, 2006, 3:03 pm
FAQ 4.22 How do I expand function calls in a string? May 26, 2006, 9:03 am
FAQ 4.22 How do I expand function calls in a string? June 21, 2006, 3:03 pm
FAQ 4.22 How do I expand function calls in a string? October 9, 2006, 9:03 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap