Re: Checking if a scalar value is a number or not

2004-12-02 Thread Jay
On Wed, 1 Dec 2004 08:28:55 -0500, Bob Showalter <[EMAIL PROTECTED]> wrote: > John wrote: > > Hello > > > > Is there any special function for that job? > > See the FAQ article: > >perldoc -q 'is a number' > > > That all depends on what you mean by a number...the FAQ interestingly ignores

Re: Checking if a scalar value is a number or not

2004-12-02 Thread Lawrence Statton
> > very true. noted. I always forget about the greedy factor > Quick diction-alert; Greediness is something entirely different - your braino was mistaking "*" for "+" An example of greedy vs. non-greedy matching: #!/usr/bin/perl use strict; use warnings; my $phrase = 'Anna would like a bana

RE: Checking if a scalar value is a number or not

2004-12-01 Thread Ramprasad A Padmanabhan
On Wed, 2004-12-01 at 19:04, Bob Showalter wrote: > Ing. Branislav Gerzo wrote: > > Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) > > contributed this to our collective wisdom: > > > > > > Is there any special function for that job? > > > > > personally I would use a rexex: > >

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Ing. Branislav Gerzo
Bob Showalter [BS], on Wednesday, December 1, 2004 at 08:34 (-0500 ) wrote these comments: >> if ($myunknownvalue =~ m/^\d+$/) BS> Your regex matches the string "123\n", if it matters. I think, it is good, and 99% users expect that, even they don't know that. -- ...m8s, cu l8r, Brano. [Dave.

RE: Checking if a scalar value is a number or not

2004-12-01 Thread Bob Showalter
Ing. Branislav Gerzo wrote: > Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) > contributed this to our collective wisdom: > > > > Is there any special function for that job? > > > personally I would use a rexex: > > if ($myunknownvalue =~ m/^\d*$/) > > personally I would change

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Paul Johnson
On Wed, Dec 01, 2004 at 02:00:49PM +0100, Ing. Branislav Gerzo wrote: > Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) > contributed this to our collective wisdom: > > >> Is there any special function for that job? > > MH> personally I would use a rexex: > MH> if ($myunknownval

RE: Checking if a scalar value is a number or not

2004-12-01 Thread Bob Showalter
John wrote: > Hello > > Is there any special function for that job? See the FAQ article: perldoc -q 'is a number' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Mat Harris
On Wed, Dec 01, 2004 at 02:00:49PM +0100, Ing. Branislav Gerzo wrote: > Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) > contributed this to our collective wisdom: > > >> Is there any special function for that job? > > MH> personally I would use a rexex: > MH> if ($myunknownvalu

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Ing. Branislav Gerzo
Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) contributed this to our collective wisdom: >> Is there any special function for that job? MH> personally I would use a rexex: MH> if ($myunknownvalue =~ m/^\d*$/) personally I would change this regex to: if ($myunknownvalue =~ m/^\

Re: Checking if a scalar value is a number or not

2004-12-01 Thread Mat Harris
On Wed, Dec 01, 2004 at 02:12:58 +0200, John wrote: > Hello > > Is there any special function for that job? personally I would use a rexex: if ($myunknownvalue =~ m/^\d*$/) { print "this is a number\n"; } else { print "this is some crap\n"; } hope this helps mat -- Cats land