On Wednesday, May 15, 2002, at 01:50 , John W. Krahn wrote:
>
> $ 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
hum... how to say this
a) try with
if ( $va
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.14
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 numeri
on Wed, 15 May 2002 20:02:01 GMT, John W. Krahn wrote:
> Felix Geerinckx wrote:
>>
>> $val = 3.141592654;
>>
>> is perfectly numeric but fails your /^\d+/.
>
> No it doesn't
Of course it doesn't!
Thanks John for spotting this (missing $ at the end of the regex :-)
--
felix
--
To unsu
Felix Geerinckx wrote:
>
> on Wed, 15 May 2002 03:12:15 GMT, [EMAIL PROTECTED] (Drieux) wrote:
>
> > so you need to check that it is numeric...
> > so you could do it with say
> >
> > if ( $val =~ /^\d+/ and $val > 0 and $val <11) {
>
> Not good enough.
>
> $val = 3.141592654;
>
> is
On Wednesday, May 15, 2002, at 09:12 , Jaishree Rangaraj wrote:
> Hi
> Now, I want to check if string or charcater is in the range. Can u
> please suggest me something
http://www.wetware.com/drieux/pbl/perlTrick/RangeChecker.txt
but in that case you want to modify the
my %is_vali
Check out the perlop manpage for lt,gt,le,ge, and eq. These are the string
equivalents of <,>,<=,>=, and == respectively.
-Original Message-
From: Jaishree Rangaraj
To: [EMAIL PROTECTED]
Sent: 5/15/02 9:12 AM
Subject: Re:Question in perl syntax
Hi
Now, I want to check if string or
On Wednesday, May 15, 2002, at 02:55 , Felix Geerinckx wrote:
> on Wed, 15 May 2002 03:12:15 GMT, [EMAIL PROTECTED] (Drieux) wrote:
>>
>> so you could do it with say
>>
>>
>> if ( $val =~ /^\d+/ and $val > 0 and $val <11) {
>
> Not good enough.
>
> $val = 3.141592654;
>
> is perfectly n
on Wed, 15 May 2002 03:12:15 GMT, [EMAIL PROTECTED] (Drieux) wrote:
> so you need to check that it is numeric...
>
> so you could do it with say
>
>
> if ( $val =~ /^\d+/ and $val > 0 and $val <11) {
Not good enough.
$val = 3.141592654;
is perfectly numeric but fails your /^\
My last post is assuming that the script is cgi. Not that it would hurt
anything if the script wasn't CGI and in fact, could still legit'ly be
helpful and prudent.
- Jim
On Wed, 2002-05-15 at 00:12, drieux wrote:
>
> On Tuesday, May 14, 2002, at 06:57 , Bill Akins wrote:
>
> > How about somet
And lets not forget to remove all nulls from the user input. Nulls can
be used to trick the script into thinking its getting valid input and
its usually good practice to just strip em. It certainly can't hurt
anything and most certainly can help everything.
- Jim
$s_field =~ s/\0//g;
On Wed,
On Tuesday, May 14, 2002, at 06:57 , Bill Akins wrote:
> How about something like this:
>
> if (($s_field >= 1) && ($s_field <= 10)) {
>do something;
> }
> else {
> do something else;
> }
the problem is that as long as $s_field is always numeric,
then there wil
Jaishree:
'eq' operator is used only if the values you are comparing are anything
other than numeric data type.
'==' operator is used to compare for numeric data-type.
Your condition should be as follows:
if(($_field >=1) && ($_field <=10)){
do something
}
Similarly,
if($_field eq 'some
13 matches
Mail list logo