Click here to get back home

WHY are args for sprintf in scalar context?

 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
WHY are args for sprintf in scalar context? w.c.humann 10-31-2007
Get Chitika Premium
Posted by w.c.humann on October 31, 2007, 9:25 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 Mirco Wahab on October 31, 2007, 12:11 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
how to force scalar context July 12, 2004, 12:07 pm
list vs scalar context for localtime? October 25, 2004, 3:48 pm
file glob in scalar context March 29, 2006, 10:56 am
scalar context for testing arguments March 6, 2008, 11:10 am
Scalar variable in void context before a loop October 20, 2008, 1:49 am
substr forces scalar context with array argument November 29, 2005, 7:18 am
Why isn't void context a 'real' context December 11, 2007, 4:15 pm
Net::IRC "args" type? July 9, 2005, 12:47 am
problem with system(@args) February 18, 2005, 7:52 am
Why doesn't chdir (@args) work? June 14, 2006, 10:43 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap