Click here to get back home

use one subroutine's variable value in another subroutine inside a 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
use one subroutine's variable value in another subroutine inside a module. king 04-26-2007
Get Chitika Premium
Posted by king on April 29, 2007, 2:39 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 McCauley on April 26, 2007, 1: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

Similar ThreadsPosted
Using one methods variable value in another method inside a module April 29, 2007, 9:04 am
Using $SIG assignment inside a subroutine ... November 7, 2004, 2:38 pm
Use of constant inside a module? April 25, 2007, 10:09 am
ISO good inside-out objects module December 24, 2005, 1:37 pm
Help with variable with regex inside. December 4, 2006, 2:05 am
subroutine's name February 4, 2008, 4:34 pm
Variable containing name of function inside a package June 27, 2005, 5:10 pm
How do i get the charactors inside the ( ) from a string variable March 25, 2006, 2:46 pm
subroutine's returned value December 2, 2005, 11:58 am
using the first variable on the command line inside a perl program October 13, 2006, 4:52 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap