Click here to get back home

Perl - Parse UNC Path in a string variable

 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
Perl - Parse UNC Path in a string variable Kevin Joseph 08-12-2004
Get Chitika Premium
Posted by Joe Smith on August 13, 2004, 12:56 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 Matt Garrish on August 13, 2004, 12:42 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
Trying to parse a variable name August 17, 2004, 10:34 am
Can not add a scalar variable of path into @INC? May 8, 2007, 10:52 pm
Help: How to change PATH variable by array? August 26, 2007, 9:08 am
parse the string October 5, 2005, 9:42 am
to parse a string October 27, 2005, 4:36 pm
How to parse a string? March 5, 2007, 4:22 pm
Date::Parse mysteriously lowercases text when an unrelated variable is used. November 19, 2006, 7:35 am
embedded perl path $ENV problem September 22, 2004, 4:29 pm
Perl Regexp that deals with variable parameter-string length. March 25, 2007, 10:36 am
Using a string as a variable name. October 5, 2004, 10:34 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap