Click here to get back home

Parsing function arguments

 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
Parsing function arguments glenlow 06-23-2005
Get Chitika Premium
Posted by glenlow on June 23, 2005, 10:07 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 Paul Lalli on June 24, 2005, 6:14 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
disappearing arguments when one package function calls another October 16, 2004, 8:28 am
Parsing function args in Getopt::Long style January 11, 2008, 4:11 pm
getting arguments July 28, 2007, 4:01 pm
MASON getting arguments. June 21, 2007, 4:05 pm
Find function definition in a C file for a function with its name and starting line no. as input March 24, 2006, 12:08 am
passing arguments to subroutines August 28, 2004, 11:08 pm
passing arguments from template November 14, 2004, 3:48 am
passing array arguments May 19, 2005, 9:36 am
Command-Line Arguments November 12, 2005, 6:09 pm
Arguments not passed in Windows XP June 6, 2006, 2:59 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap