Click here to get back home

12 hour clock and offset problem

 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
12 hour clock and offset problem Kenetic 06-16-2007
Get Chitika Premium
Posted by Kenetic on June 16, 2007, 11:40 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 June 16, 2007, 12:19 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 Kenetic on June 17, 2007, 7:05 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 Dr.Ruud on June 17, 2007, 12:16 pm
Please log in for more thread options
Kenetic schreef:

> perl's mod doesn't work very well with fractions

<quote src="perlop">
Binary "%" computes the modulus of two numbers. Given
integer operands $a and $b: If $b is positive, then "$a %
$b" is $a minus the largest multiple of $b that is not
greater than $a. If $b is negative, then "$a % $b" is $a
minus the smallest multiple of $b that is not less than $a
(i.e. the result will be less than or equal to zero).
Note that when "use integer" is in scope, "%" gives you
direct access to the modulus operator as implemented by
your C compiler. This operator is not as well defined for
negative operands, but it will execute faster.
</quote>

Nothing is mentioned there about fractional behaviour. But I was never
surprised because *in my world*, "modulus" operates on integers. So
AFAIK, Perl's mod works perfectly with fractions.

--
Affijn, Ruud

"Gewoon is een tijger."


Posted by Brian McCauley on June 18, 2007, 4:27 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
Clock July 20, 2006, 1:42 pm
waitpid interruped by "Alarm clock" July 8, 2004, 4:33 pm
Timer/alarm clock module July 29, 2005, 6:53 pm
unpack with offset (skip, X) won't work October 7, 2006, 12:51 pm
Did not find leading dereferencer, detected at offset September 16, 2006, 5:19 am
Did not find leading dereferencer, detected at offset September 16, 2006, 5:20 am
Scan forward n lines from specified file offset November 5, 2006, 2:33 pm
time zone offset calc with localtime and gmtime April 4, 2005, 6:07 pm
update: timezone offset calc and date formatting April 8, 2005, 1:32 pm
Problem installing modules on redhat 9 - strange connection problem January 26, 2005, 5:19 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap