Link to home
Start Free TrialLog in
Avatar of Silentbob19
Silentbob19

asked on

Perl roockie! please help

Hello, this is my first day using perl and site experts-exchange.com to.

I making a single perl script to read from a text file and then ask for an action.  
chop ($number);
if ($number eq 4){
     print "Cool.\n\n";
     }
if ($number ge 5){
     print "That's to much!\n\n";
     }
else {
     print "That's Nothing";
     }

If I put 3 or less it says  "That's Nothing" (OK)
If I put 5 or more it says  "That's to much!"; (OK)

But why if I set eq 4 says "Cool." when I put 4 it says
"Cool."   - and also -   "That's Nothing"

ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Silentbob19
Silentbob19

ASKER

why do you use "my"?
And why chomp and not chop?

There's a diference if a use it like
$number = <STDIN>;
chop ($number);
Also if I put 125 for ex. It't thinks it is 1 and not 125

Sorry about my english... I speak spanish.
I used my so the code would pass "use strict;"

chomp is safer in that it only removes $/
Also if I put 125 for ex. It't thinks it is 1 and not 12

 ge is a string comnpare, use >= to compare numbers
Thank's so mucho... This is my first day on perl... I have to learn  a lot.