Results 1 to 7 of 7

Thread: If in perl?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    32

    Unhappy If in perl?

    Code:
    $number = (int(rand($total));
    $nbr


    I want the program to choose the [int[rand....) if the $nbr not is 200 or more, and it should choose $nbr if $nbr is over 200.
    How would i be doing this?

  2. #2
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    New Jersey
    Posts
    334
    Hmm, please calrify. I don't seem to understand what you want to do.

  3. #3
    Lively Member
    Join Date
    Jan 2001
    Location
    Perth, Western Australia
    Posts
    108
    I think i know what you mean... So you want the $nbr part to happen when $nbr is greater than or equal to 200 and the int part to happen when it is less than $nbr... well either way the code would look like

    Code:
    if ($nbr => 200) {
    $nbr;
    } else {
    $number = (int(rand($total));
    }
    This says that when nbr is not greater than or equal to 200 it uses the int code, but when it is it does the $nbr bit.

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    32
    Thanx!




    One more think.

    If a http://something.com?memberid is created, is it possible to track the visitor by cookies or something, and give the memberid credits when a new user signs up? Kinda referal program...
    Last edited by Mobic; Apr 28th, 2001 at 07:09 AM.

  5. #5
    Lively Member
    Join Date
    Jan 2001
    Location
    Perth, Western Australia
    Posts
    108
    yeah it is a little more advanced but i can write a script for yo uif you want and i will show you what i did so you can back engineer it... but basicly it would involve a userdatabase in this layout
    username|points
    simple... it would scan down the list to see if the member is on the list... if he is it would then add points... then stick it back into the databse...

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Norway
    Posts
    32
    Hmm..

    If you would do that it would be great.
    I've been trying for a couple of days now, and just cant get it to work.. but i guess thats what you learn by.. testing and failing..

  7. #7
    Lively Member
    Join Date
    Jan 2001
    Location
    Perth, Western Australia
    Posts
    108
    No Probz, just email some small details (the location of perl on your server, perl version, blah blah blah). I will have finished writing the script in 10 min of replying to this thread... so email me when you want it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width