Click here to get back home

"Undefined subroutine &main:: called." from nowhere??

 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
"Undefined subroutine &main:: called." from nowhere?? Matthias Urlichs 08-11-2004
Posted by Matthias Urlichs on August 11, 2004, 2:45 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 Matthias Urlichs on August 11, 2004, 3:29 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 Matthias Urlichs on August 11, 2004, 10:41 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
Undefined subroutine &main::1 called perl script October 16, 2006, 3:47 pm
Undefined subroutine &main January 19, 2007, 7:21 am
Injecting variables after the import subroutine has been called? July 7, 2004, 8:13 am
"Undefined subroutine" November 21, 2004, 8:48 pm
Undefined subroutine CGI::Vars July 26, 2004, 3:05 pm
Mystery message: Undefined subroutine &OS2::Bootdrive September 22, 2004, 5:12 pm
Error "Undefined subroutine" & module references August 10, 2005, 9:23 am
Undefined subroutine even though it appears in symbol table? January 27, 2007, 10:58 am
FAQ 4.67: Why does passing a subroutine an undefined element in a hash create it? December 13, 2004, 6:03 pm
FAQ 4.67 Why does passing a subroutine an undefined element in a hash create it? May 11, 2005, 11:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap