Re: misunderstanding

2009-07-18 Thread Chas. Owens
2009/7/18 Octavian Râşniţă : > From: "Dr.Ruud" >> >> To me that means that you "don't get it" yet. > > Oh yes I get it, but I don't like it. > > What would be the problem if the way of doing calculations by using bignum > would be the default? > Does it give errors? It would be helpful to know. >

Re: Dispatch tables and named args

2009-07-18 Thread Chas. Owens
On Sat, Jul 18, 2009 at 21:54, David Christensen wrote: > Steve Bertrand wrote: >> I've been reading both the Cookbook and HOP > > HOP? snip Higher Order Perl: http://hop.perl.plover.com -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsu

Re: misunderstanding

2009-07-18 Thread Jim Gibson
At 4:25 AM +0300 7/19/09, Octavian Râs¸nit¸a˜ wrote: From: "Dr.Ruud" To me that means that you "don't get it" yet. Oh yes I get it, but I don't like it. No, you don't seem to understand. Perl, PHP, and all other languages do floating-point arithmetic using the built-in arithmetic provided

RE: Dispatch tables and named args

2009-07-18 Thread David Christensen
Steve Bertrand wrote: > I've been reading both the Cookbook and HOP HOP? > My question is, is if it is common practise to use named parameters > for incoming arguments to functions/methods. I tend to code for personal, private use, so I have the luxury of changing my mind as the mood suits me.

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Dr.Ruud" To me that means that you "don't get it" yet. Oh yes I get it, but I don't like it. What would be the problem if the way of doing calculations by using bignum would be the default? Does it give errors? It would be helpful to know. Octavian -- To unsubscribe, e-mail: begin

Fwd: NET::FTP object constructor's host option as array reference

2009-07-18 Thread Jefferson Kirkland
Sorry, original message had wrong address for this list and I didn't notice. Here is the chain. Regards, Jeff -- Forwarded message -- From: Jefferson Kirkland Date: Sat, Jul 18, 2009 at 9:17 PM Subject: Re: NET::FTP object constructor's host option as array reference To: Core

Re: misunderstanding

2009-07-18 Thread Dr.Ruud
Octavian Râşniţă wrote: It sounds like a limitation of perl because it makes the calculations at a too low level and not correct the errors automaticly, and not a limitation of computers in general, because PHP does it right, MS Excel does it right, the Windows Calculator does it right, so it

NET::FTP object constructor's host option as array reference

2009-07-18 Thread Corey Foote
I'm building an FTP client using NET::FTP. The documentation states that the new constructor has a host option which can be a reference to an array with hosts to try in turn. I don't seem to be able to get this to work. I'm using ActivePerl under Windows XP. Here's my code: @try_these = ("turi

Re: misunderstanding

2009-07-18 Thread Dr.Ruud
Octavian Râşniţă wrote: Dr.Ruud: Octavian Rasnita: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float cal

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "OR" == Octavian Râşniţă writes: OR> From: "Uri Guttman" OR> sorry to say but you still don't get it. automatically rounding numbers OR> is not higher level NOR correct. there is NO correct way to handle OR> floating numbers like that. none. nada. it is a very well known issue in

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Uri Guttman" sorry to say but you still don't get it. automatically rounding numbers is not higher level NOR correct. there is NO correct way to handle floating numbers like that. none. nada. it is a very well known issue in ALL programming languages that support floats. some choose conven

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "SHC" == Shawn H Corey writes: SHC> Uri Guttman wrote: >> the correct solution for money has always been to use integers >> for the smallest amount (e.g. cents). this will always be correct in all >> languanges. >> SHC> Sorry, but sometimes you have to use real numbers. On th

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Uri Guttman wrote: the correct solution for money has always been to use integers for the smallest amount (e.g. cents). this will always be correct in all languanges. Sorry, but sometimes you have to use real numbers. On the news, exchange rates are given to a thousand of a cent, which is OK

Re: Dispatch tables and named args

2009-07-18 Thread Uri Guttman
> "SB" == Steve Bertrand writes: SB> I tend to read past the finer points that people refer to. For SB> instance... dispatch tables. It is hard for me to wrap my head around SB> how immensely useful such subtle things can be! dispatch tables are very easy in perl and extremely useful.

Re: misunderstanding

2009-07-18 Thread Uri Guttman
> "OR" == Octavian Râşniţă writes: OR> From: "Shawn H. Corey" >> Either the programs (not the languages) are doing their calculations >> in cents, not dollars or they are rounding off at a higher level >> than Perl. You just think they are not making errors because they're >> not t

Re: help with a regex

2009-07-18 Thread Dan Wallis
2009/7/18 Jenn G. : > next if /\/0$|^127\./; > > ( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1 > it will be next.) When you say, "it will be next" it sounds like you want it to be processed. The next keyword stops this loop iteration short, and continues at the next iterati

Dispatch tables and named args

2009-07-18 Thread Steve Bertrand
Thanks to all of the on, and off-list feedback I've received over the last month, I've realized I've been missing out on quite a bit. I tend to read past the finer points that people refer to. For instance... dispatch tables. It is hard for me to wrap my head around how immensely useful such subtl

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Shawn H. Corey" Either the programs (not the languages) are doing their calculations in cents, not dollars or they are rounding off at a higher level than Perl. You just think they are not making errors because they're not telling you what they're really doing. They give a different r

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Octavian Râşniţă wrote: I read it, and it doesn't sound very well: "Rounding in financial applications can have serious implications, and the rounding method used should be specified precisely. In these cases, it probably pays not to trust whichever system rounding is being used by Perl, but to

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Chas. Owens wrote: Before you go blaming computers, what is the exact value of Pi again? Understanding the limitations of reality and computers is your job if you want accurate results. You can't get accurate results, that's the problem. The questions to ask are: * What degree of accuracy

Re: misunderstanding

2009-07-18 Thread Octavian Râşniţă
From: "Shawn H. Corey" Octavian Râşniţă wrote: Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calculation with an infinite number of digits. But yes, it is not just a fault of perl. Since all the languages use the same math co-

Re: misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Chas. Owens
2009/7/18 Octavian Râşniţă : > From: "Dr.Ruud" > Octavian Rasnita wrote: >> >>> print 0.79 - 0.798; >>> >>> -0.00801 >>> >>> which is obviously wrong. >> >> And it is obvious to me that you are wrong. Funny hey? >> >> -- >> Ruud > > Sorry but the calculation is obviously wrong. It is n

Re: misunderstanding

2009-07-18 Thread Shawn H. Corey
Octavian Râşniţă wrote: Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calculation with an infinite number of digits. But yes, it is not just a fault of perl. Since all the languages use the same math co-processor, they all get i

Re: misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Octavian Râşniţă
From: "Dr.Ruud" Octavian Rasnita wrote: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? -- Ruud Sorry but the calculation is obviously wrong. It is not my fault that the computers can't make a perfect float calcu

Re: Using a string as a hash (symbolic ref)

2009-07-18 Thread Steve Bertrand
Steve Bertrand wrote: > However, I needed to take two seconds to at least state that my claim, > that the second param into Test::More "is forced into qr//" was > unfounded and unjustified. > > I don't know if that is what happens For completeness (and as a code tracking exercise for myself),

misunderstanding (was: Re: bug in perl?)

2009-07-18 Thread Dr.Ruud
Octavian Rasnita wrote: print 0.79 - 0.798; -0.00801 which is obviously wrong. And it is obvious to me that you are wrong. Funny hey? -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org

Re: swapping values in an array

2009-07-18 Thread Shawn H. Corey
Robert Citek wrote: This doesn't: $ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; ' perl -Mstrict -Mwarnings -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; ' Always use strict and warnings :) -- Just my 0.0002 million dollars worth, Shawn Prog

swapping values in an array

2009-07-18 Thread Robert Citek
Is there an easier way to swap two values in an array? This works: $ perl -le '@a=(1,2,3,4) ; ($a[0],$a[1])=($a[1],$a[0]) ; print join("\t", @a) ; ' 2 1 3 4 This doesn't: $ perl -le '@a=(1,2,3,4) ; $a[0,1]=$a[1,0] ; print join("\t", @a) ; ' 1 1 3 4 Regar

Re: swapping values in an array

2009-07-18 Thread Robert Citek
Nevermind, I knew I was overlooking something simple: use @ symbol. $ perl -le '@a=(1,2,3,4) ; @a[0,1...@a[1,0] ; print join("\t", @a) ; ' 2 1 3 4 Regards, - Robert On Fri, Jul 17, 2009 at 2:03 PM, Robert Citek wrote: > Is there an easier way to swap two values in an array? >

Re: bug in perl

2009-07-18 Thread Octavian Râsnita
From: "Telemachus" On Fri Jul 17 2009 @ 3:18, Octavian Rasnita wrote: From: "Shawn H. Corey" Octavian Rasnita wrote: Well, in PHP that calculation is made well, so I think there is a bug in perl. No, it's not. PHP rounds off the number before printing. In Perl: printf "%.2f", $x; or