Drieux wrote: > > On Wednesday, May 15, 2002, at 01:02 , John W. Krahn wrote: > > Felix Geerinckx wrote: > >> on Wed, 15 May 2002 03:12:15 GMT, [EMAIL PROTECTED] (Drieux) wrote: > [..] > >>> if ( $val =~ /^\d+/ and $val > 0 and $val <11) { > >> > >> Not good enough. > >> > >> $val = 3.141592654; > >> > >> is perfectly numeric but fails your /^\d+/. > > > > No it doesn't > > > > $ perl -le' > > $val = 3.141592654; > > if ( $val =~ /^\d+/ and $val > 0 and $val <11) { > > print "True" } > > else { > > print "False" } > > ' > > True > > how galant - to try to rescue me from that BRUTE! > but only technically correct. > > since if you set > > $val = "3.145BOB"; > > you will notice that this would slide through as true. > > but would be considered as FALSE as 3.14 > > if ( $val =~ /^\d+$/ and $val > 0 and $val <11) { > > so the shift to using the is_numeric() as that > really really brutish cad suggested.....
$ perl -le' $val = q/3.1415BOB/; if ( $val =~ /^\d+/ and $val > 0 and $val <11) { print "True" } else { print "False" } print 1 + $val; ' True 4.1415 It seems to work here. What specifically is not working for you? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]