Click here to get back home

Howto share variables among script & module

 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
Howto share variables among script & module Bernd Schneider 04-03-2006
Posted by Bernd Schneider on April 3, 2006, 10:40 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 Tad McClellan on April 3, 2006, 11:52 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 Bart Van der Donck on April 4, 2006, 5:50 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
Howto share filehandles between threads? June 2, 2006, 9:23 am
How can I access variables in my perl script from a sub in a module January 3, 2007, 6:50 pm
HOWTO - do local ppm module install (fix "Could not locate a PPDfile") July 9, 2005, 5:25 pm
Howto Install a Perl Wrapper Module for a C Library Locally March 22, 2006, 4:47 am
Mod_perl: can I share a database connection by putting it in thestartup-script? February 13, 2005, 4:14 pm
How to construct new variables in a script from other variables and strings. May 12, 2006, 4:51 am
Module to print out all package variables...? August 12, 2004, 10:29 am
Global variables from a module, while using strict June 30, 2005, 5:58 pm
Own module needs loaded module from main script August 25, 2004, 12:43 pm
Using Variables from Another Script April 3, 2006, 3:22 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap