Click here to get back home

Getopt::Long (how to make it die after saying "option requires an argument"?)

 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
Getopt::Long (how to make it die after saying "option requires an argument"?) Perl Learner 06-13-2005
Posted by Perl Learner on June 13, 2005, 11:05 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 Jim Keenan on June 13, 2005, 11:25 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
Getopt::Std , option with no argument December 27, 2005, 7:52 am
Option Values with Spaces using GetOpt::Long October 10, 2006, 2:30 am
Getopt::Std argument list mistake? August 20, 2006, 7:41 am
Version? Getopt::Long October 4, 2004, 3:00 pm
beginner trying to use Getopt::Long October 12, 2006, 2:58 pm
Getopt::Long install problems October 4, 2004, 6:33 pm
How to pass a range (2 .. 42) by Getopt::Long to a script? March 6, 2008, 6:38 pm
Parsing function args in Getopt::Long style January 11, 2008, 4:11 pm
Having problems parsing command line options using Getopt::Long on windows December 2, 2004, 8:48 am
FAQ 5.14 Why do I sometimes get an "Argument list too long" when I use <*>? February 9, 2005, 6: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