Click here to get back home

modifying a variable twice in a statement (comparison to c)

 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
modifying a variable twice in a statement (comparison to c) Ivan Novick 02-04-2007
Get Chitika Premium
Posted by Ben Bacarisse on February 4, 2007, 9:33 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 Abigail on February 5, 2007, 3:09 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
Modifying Array inside While statement December 26, 2005, 5:54 pm
Simple comparison statement that doesn't work December 14, 2005, 7:12 pm
Modifying and printing a string variable September 12, 2006, 2:31 am
puzzling behavior in simple variable comparison September 26, 2005, 5:07 pm
Variable in "if" statement August 17, 2004, 12:59 pm
Using a for() statement to create a variable?? March 26, 2005, 1:04 pm
A variable within an Inline use statement August 26, 2008, 4:05 am
Hard coded vs. variable assignment using in SQL statement. December 29, 2004, 12:28 am
modifying @ISA August 6, 2004, 4:09 am
Modifying ls June 12, 2006, 4:13 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap