Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

if ($count >= $amount){ &next}?

if ($count >= $amount){ &next}?



11:44 pm on Jul 24, 2003 (gmt 0)

10+ Year Member

I got a new easy question for the perl guruís on WebmasterWorld.com

This line says if $count is same as 10 or more then run sub next...

$amount = "10";
if ($count >= $amount){ &next}

My question is how do i say run sub next if $count is 10 or less?

not 10 and up but 10 and less ...

thanks ...


11:53 pm on Jul 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

you could use an if-else statement.

if ( $count >= $amount ){
print "count is greater than or equal to 10";}
else {
print "count is less than 10";}

but instead of the print function you can call your respective subroutines.

<edited cuz I had my operator backwards :) - thanks Damian>

[edited by: oilman at 11:59 pm (utc) on July 24, 2003]


11:56 pm on Jul 24, 2003 (gmt 0)

10+ Year Member

Numeric comparison

== equality
!= inequality
< less than
> greater than
<= less than or equal
>= greater than or equal

Perl Builtin operators and functions [perldoc.com]


12:05 am on Jul 25, 2003 (gmt 0)

10+ Year Member

no i can not use: if-else
as i am already using the else for the next function ...

i will go for: <=

that where what i was looking for ...
i hope it works ..
so Damian my code should be:

$amount = "10";
if ($count <= $amount){ &next}

is this correct?

thx both

its the little things that count ;-) like <=
thx for the link its very usefull


Featured Threads

Hot Threads This Week

Hot Threads This Month