Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Converting to decimal elsif

by HyperZonk (Friar)
on Jul 26, 2001 at 01:14 UTC ( [id://99807]=note: print w/replies, xml ) Need Help??


in reply to Converting to decimal elsif

You are doing your comparisons sdrawkcab. You match anything larger than 7.5 before you test for 22.5, so it never makes it there. The logic you are using would work if you were using sequential ifs instead of elsifs, but that is, of course, not the best way to do it. You might try:
if ($startmin >= 52.5) { ... } elsif ($startmin >= 37.5) { ... } elsif ($startmin >= 22.5) { ... } elsif ($startmin >= 7.5 ) { ... } else { ... }
Update: ... and of course, bikeNomad's method will work, also reversing the test and the order. (That rat got in before me! :)

-HZ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-16 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found