RE: numeric vs string scalars...difference?

2004-11-17 Thread Paul Sobey
:44 To: Perl-Win32-Users Subject: Re: numeric vs string scalars...difference? Hi Andy, Thanks for your response. For clarification I'm doing equality comparisons. Thus... $x = '45.0'; $y = '45'; if ($x eq $y) {print values are equal;} ...does not product the desired result (i.e

Re: numeric vs string scalars...difference?

2004-11-17 Thread Paul Rogers
- From: Paul Sobey [EMAIL PROTECTED] To: Paul Rogers [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 4:16 AM Subject: RE: numeric vs string scalars...difference? Hi, Isn't eq a string comparison? Try using == instead: print String compares\n if 45 eq 45.0; # Fails

RE: numeric vs string scalars...difference?

2004-11-17 Thread Thomas, Mark - BLS CTR
] Subject: Re: numeric vs string scalars...difference? Hi Paul, You are absolutely right. However, the real problem was that I had to dynamically determine whether to use == or eq...thus I needed a way of reliably determining whether a variable was numeric or string. That's where

Re: numeric vs string scalars...difference?

2004-11-17 Thread Paul Rogers
: Thomas, Mark - BLS CTR [EMAIL PROTECTED] To: 'Paul Rogers' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 2:07 PM Subject: RE: numeric vs string scalars...difference? How about 1.02e12? If you want to know if it looks like a number to perl, this might be handy: use

RE: numeric vs string scalars...difference?

2004-11-16 Thread Arms, Mike
Paul Rogers [perl-users AT coservers DOTnet] wrote: I need to dynamically do comparisons tests on an array of values...some strings, some numeric. One snag I hit is comparing the occasional numeric values. Using eq as the comparison operator fails on comparisons like 45.0 vs 45. Is

Re: numeric vs string scalars...difference?

2004-11-16 Thread Paul Rogers
=~ /^-?(\d+\.?\d*|\.\d+)$/) { print This is a numeric value.; } Thanks, Paul --- - Original Message - From: Andy Bach To: Paul Rogers [EMAIL PROTECTED] Sent: Tuesday, November 16, 2004 6:03 PM Subject: Re: numeric vs string scalars...difference? 45.0 vs 45. So should they match