Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

(ar0n) Re: How do I get a loop to recognize a number between $i and $i+1 (a decimal number)

by ar0n (Priest)
on Jul 26, 2001 at 11:20 UTC ( [id://99911]=note: print w/replies, xml ) Need Help??


in reply to How do I get a loop to recognize a number between $i and $i+1 (a decimal number)

Multiply it by a large factor and divide:
for my $n (0..100) { $n /= 100; # do something with a number between 0.00 and 1.00 }
or, for something more arbitrary:
for my $n (437 .. 1287) { $n /= 1000; # do something with a number between .437 and 1.287 }
update: the more i read the question, the less certain i am i know what you mean... hope this helps, though...

ar0n ]

Replies are listed 'Best First'.
Re: (ar0n) Re: How do I get a loop to recognize a number between $i and $i+1 (a decimal number)
by Kailua362 (Novice) on Jul 26, 2001 at 12:50 UTC
    Aloha, Mahalo for your reply. I am just a beginner. What I am trying to write is a script to correct an online quiz. It works fine for questions that have only one value. But I'm trying to get it to recognize that some questions have more than one value (because they may have dropdown boxes) What I thought I would do was give half credit if one of the two drop down boxes were correct. kailua362

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://99911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-28 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found