Re: floating point precision

2010-09-01 Thread Paul Johnson
On Wed, Sep 01, 2010 at 04:46:30PM -0400, Jim wrote: > Can anyone comment how they handle floating point precision situations > like this? > > Here is a basic toy program: > #!/usr/bin/perl > > use strict; > > my $total = 0; > my $a = 21835.30; > my $b = -21715.90; > my $c = 9652.20; > my $d = -9

Re: floating point precision

2010-09-01 Thread Jim Gibson
On 9/1/10 Wed Sep 1, 2010 1:46 PM, "Jim" scribbled: > Can anyone comment how they handle floating point precision situations > like this? > > Here is a basic toy program: > #!/usr/bin/perl > > use strict; > > my $total = 0; > my $a = 21835.30; > my $b = -21715.90; > my $c = 9652.20; > my $d

Re: floating point precision

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 17:32, Jim wrote: > On 9/1/2010 5:04 PM, Chas. Owens wrote: >> >> On Wed, Sep 1, 2010 at 16:46, Jim  wrote: >>> >>> Can anyone comment how they handle floating point precision situations >>> like >>> this? >> >> snip >>> >>> I don't like either of these solutions. >>> >>> Ho

Re: floating point precision

2010-09-01 Thread Shawn H Corey
On 10-09-01 05:32 PM, Jim wrote: Thanks... that's the sort of answer I've been reading about... not crazy about it... but it is what it is. This problem is more infuriating than unsolvable in terms of why I need to even think about something like this. My $0.99 calculator can computer those numbe

Re: floating point precision

2010-09-01 Thread Jim
On 9/1/2010 5:04 PM, Chas. Owens wrote: On Wed, Sep 1, 2010 at 16:46, Jim wrote: Can anyone comment how they handle floating point precision situations like this? snip I don't like either of these solutions. How do others deal with this? snip Short answer: floating point numbers suck, but

Re: floating point precision

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 16:46, Jim wrote: > Can anyone comment how they handle floating point precision situations like > this? snip > I don't like either of these solutions. > > How do others deal with this? snip Short answer: floating point numbers suck, but are fast. If you need accuracy you s

floating point precision

2010-09-01 Thread Jim
Can anyone comment how they handle floating point precision situations like this? Here is a basic toy program: #!/usr/bin/perl use strict; my $total = 0; my $a = 21835.30; my $b = -21715.90; my $c = 9652.20; my $d = -9771.60; print ("total = $total\n"); $total += $a; print ("total = $total\n"

Re: Question on Unless and Until

2010-09-01 Thread Paul Johnson
On Wed, Sep 01, 2010 at 01:00:21PM -0400, Brandon McCaig wrote: > On an unrelated note, what is correct quoting etiquette when you only > want to quote part of a line? This is how I do it: > Above, I just reformatted the quote onto > a single line beginning at the s

Re: Question on Unless and Until

2010-09-01 Thread Brandon McCaig
On Wed, Sep 1, 2010 at 12:12 PM, Shawn H Corey wrote: > Of course, if you want to make the purists cringe: > > if( some_condition ){ >  # this space intentionally left blank > }else{ >  do_work(); > } I actually have at least one colleague that does that (not at "Castopulence"[1], but at my real

Re: Question on Unless and Until

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 12:12, Shawn H Corey wrote: > On 10-09-01 11:37 AM, Chas. Owens wrote: >> >> I don't care if you use unless or if, but please don't use if (!). >> Say if (not) instead.  The looser binding makes it easier to use and >> the fact that it is three letters long (rather than one

Re: Question on Unless and Until

2010-09-01 Thread Shawn H Corey
On 10-09-01 11:37 AM, Chas. Owens wrote: I don't care if you use unless or if, but please don't use if (!). Say if (not) instead. The looser binding makes it easier to use and the fact that it is three letters long (rather than one skinny character long) makes it some much easier to see. You d

Re: Question on Unless and Until

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 11:12, Shlomi Fish wrote: > On Wednesday 01 September 2010 18:06:37 Brandon McCaig wrote: >> On Mon, Aug 30, 2010 at 2:25 AM, Uri Guttman wrote: >> > but i never use until anyhow. i use unless a fair amount as i don't like >> > if ( ! EXPR). my current boss has asked me to

Re: Question on Unless and Until

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 11:06, Brandon McCaig wrote: > On Mon, Aug 30, 2010 at 2:25 AM, Uri Guttman wrote: >> but i never use until anyhow. i use unless a fair amount as i don't like >> if ( ! EXPR). my current boss has asked me to stop using unless but i am >> not stopping. > > It seems silly to

Re: Question on Unless and Until

2010-09-01 Thread Shlomi Fish
On Wednesday 01 September 2010 18:06:37 Brandon McCaig wrote: > On Mon, Aug 30, 2010 at 2:25 AM, Uri Guttman wrote: > > but i never use until anyhow. i use unless a fair amount as i don't like > > if ( ! EXPR). my current boss has asked me to stop using unless but i am > > not stopping. > > It se

Re: Question on Unless and Until

2010-09-01 Thread Brandon McCaig
On Mon, Aug 30, 2010 at 2:25 AM, Uri Guttman wrote: > but i never use until anyhow. i use unless a fair amount as i don't like > if ( ! EXPR). my current boss has asked me to stop using unless but i am > not stopping. It seems silly to use unless, but never use until. :) I think both make the cod

Re: Recursively filter an array

2010-09-01 Thread Shawn H Corey
On 10-09-01 07:55 AM, Kryten wrote: Hi, I'm very much a beginner. Could anyone point me in the right direction on how to accomplish the following, please? I have a fairly long log file call it file A, it has around 20,000 lines of three element space separated variables. File A looks like:-

Re: Recursively filter an array

2010-09-01 Thread Chas. Owens
On Wed, Sep 1, 2010 at 07:55, Kryten wrote: > Hi, > > I'm very much a beginner. > > Could anyone point me in the right direction on how to accomplish the > following, please? > > I have a fairly long log file call it file A, it has around 20,000 > lines of three element space separated variables.

Re: Recursively filter an array

2010-09-01 Thread Shlomi Fish
Hi Stuart, On Wednesday 01 September 2010 14:55:21 Kryten wrote: > Hi, > > I'm very much a beginner. > > Could anyone point me in the right direction on how to accomplish the > following, please? > > I have a fairly long log file call it file A, it has around 20,000 > lines of three element spa

Recursively filter an array

2010-09-01 Thread Kryten
Hi, I'm very much a beginner. Could anyone point me in the right direction on how to accomplish the following, please? I have a fairly long log file call it file A, it has around 20,000 lines of three element space separated variables. File A looks like:- 55223 jimmy smith 55224 davy crocket 5

Re: How can I open a remote ssh session with perl

2010-09-01 Thread Salvador Fandino
On 08/27/2010 05:47 AM, S Pratap Singh wrote: > Hello Peter , > > Did you try executing command "top -cd2", "iostat 1", vmstat 1 10" etc ? Did > you get the output of those command ? I am not getting the output of these > commands rest works fine for me. use Net::OpenSSH; my $ssh = Net::Open

Re: How can I open a remote ssh session with perl

2010-09-01 Thread Salvador Fandino
On 08/25/2010 07:51 PM, C.DeRykus wrote: > On Aug 24, 12:28 pm, frase...@gmail.com (Brian Fraser) wrote: >> On Tue, Aug 24, 2010 at 11:08 AM, Peter Scott wrote: >>> CPAN: Net::SSH::Perl . >> >> I had a similar issue not too long ago; Spent a couple of days attempting to >> get Net::SSH::Perl to co

RE: testing tcp connection

2010-09-01 Thread Kammen van, Marco, Springer SBM NL
-Original Message- From: Thomas Bätzler [mailto:t.baetz...@bringe.com] Sent: Wednesday, September 01, 2010 8:57 AM To: beginners@perl.org Cc: Kammen van, Marco, Springer SBM NL Subject: AW: testing tcp connection >>Kammen van, Marco, Springer SBM NL asked: >> I have an issue when somethi