homepage Welcome to WebmasterWorld Guest from 107.21.135.68
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

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




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

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 ...

 

oilman




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

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]

Damian




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

Numeric comparison

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


Perl Builtin operators and functions [perldoc.com]

StopSpam




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved