Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: using int and the range function

by soonix (Canon)
on Jan 16, 2015 at 07:42 UTC ( [id://1113445]=note: print w/replies, xml ) Need Help??


in reply to Re: using int and the range function
in thread using int and the range function

I think this is closest to the OP's intent, because it also detects if the number doesn't fit into an "integer".

But I'd change the if condition to
... if $input eq int $input;
because for humans that's easier to parse than
... if int $input eq $input;

Replies are listed 'Best First'.
Re^3: using int and the range function
by Laurent_R (Canon) on Jan 16, 2015 at 07:49 UTC
    Yes, you are right, it makes precedence comprehension a little bit easier. I actually thought of changing it the way you put it when I posted it, but since I tested it under the debugger the way I wrote it, I prefered not to change my post to something untested. In a real program, I would probably change it to make it clearer.
    Je suis Charlie.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found