Meta question about 'isNumber()' --- should it return true or false for
the string 0 but true. As far as Perl is concerned that *is* a number,
right? :o)
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
mailto:[EMAIL PROTECTED] Pearisburg, VA
-- Too many people,
On Fri, 19 Oct 2001 18:05:54 +0100, [EMAIL PROTECTED] (Piers Cawley)
wrote:
#!/usr/bin/perl6
sub is_number ($number) { return +$number eq 'NaN' }
s/eq/ne/ ?
Cheers,
Philip
Selector, Lev Y [EMAIL PROTECTED] writes:
Folks,
It was long time - no messages (on this list).
Is everybody OK?
I am working in downtown New York City -
and still can smell burning outside the building:
http://www.spaceimaging.com/ikonos/wtc0915_1280.jpg
I have a (simple) Perl
On Fri, 19 Oct 2001, Philippe 'BooK' Bruhat wrote:
On Fri, 19 Oct 2001, Matt Bernstein wrote:
how about ($x+0 eq $x)
(rather untested)
perl -ne 'chomp;print+($_+0eq$_)?:NOT,a number\n'
Stupid question: Is 1.00 a number?
Robert
--
On Thu, 18 Oct 2001 at 20:43:40 -0400, Uri Guttman wrote:
IP == Ian Phillipps [EMAIL PROTECTED] writes:
IP I feel sure this is a FAQ...
trust your feelings. i didn't answer because it IS an FAQ. FAQ's aren't
fun. :)
Oh, I don't know. My solution is a few strokes better than the FAQ's :-)
IP == Ian Phillipps [EMAIL PROTECTED] writes:
IP On Thu, 18 Oct 2001 at 20:43:40 -0400, Uri Guttman wrote:
IP == Ian Phillipps [EMAIL PROTECTED] writes:
IP I feel sure this is a FAQ...
trust your feelings. i didn't answer because it IS an FAQ. FAQ's aren't
fun. :)
IP Oh, I
At 01:19 AM 10/19/01 +0100, Ian Phillipps wrote:
On Thu, 18 Oct 2001 at 18:33:53 -0400, Selector, Lev Y wrote:
Wow! This is really elegant !!
-Original Message-
From: Josh Goldberg [mailto:[EMAIL PROTECTED]]
sub isNumber {
!/\d/ ? 0 : $_ == 0 ? 1 : $_ * 1
}
Possibly
IP == Ian Phillipps [EMAIL PROTECTED] writes:
IP I feel sure this is a FAQ...
trust your feelings. i didn't answer because it IS an FAQ. FAQ's aren't
fun. :)
perldoc -q number
How do I determine whether a scalar is a
number/whole/integer/float?
uri
--
Uri Guttman
On Thu, Oct 18, 2001 at 04:49:56PM -0400, Selector, Lev Y wrote:
I have a (simple) Perl question.
Is there a standard function in perl which can tell me
if a string represents a valid number?
(including integer, with decimal point and scientific notaion with e).
When in doubt, ask Perl.
True enough, I thought I had been booted off the list or something...
Just wanted to comment, that if you roll your own number detector, and you
want it compatible with *nix Perl, you should count as a number any string
beginning with letters inf (case insensitive).
This is an undocumented
On Thu, 18 Oct 2001, Selector, Lev Y wrote:
Any recommendations?
something like this perhaps?
ns21# cat t.pl
#!/usr/bin/perl
sub isNumber {
!/\d/ ? 0 : $_ == 0 ? 1 : $_ * 1
}
for ( qw[ 0 abcdefg 1 -1.0 1.0e-10 10abc ] ) {
print $_ - , isNumber($_), \n;
}
ns21# perl t.pl
0 -
Selector
-Original Message-
From: Josh Goldberg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 18, 2001 6:47 PM
To: Selector, Lev Y
Cc: '[EMAIL PROTECTED]'
Subject: Re: isNumber( ) ??
On Thu, 18 Oct 2001, Selector, Lev Y wrote:
Any recommendations?
something like
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thursday, October 18, 2001, at 09:03 , Michael G Schwern wrote:
When in doubt, ask Perl.
sub is_num {
my($cand) = shift;
my $not_num;
local $^W = 1;
local $SIG{__WARN__} = sub {
$not_num = $_[0] =~ /^Argument .*?
13 matches
Mail list logo