davido has already explained how Perl converts strings to numbers which should answer your question. However, I'll point out an improvement to your input function:
sub input { print @_; my $r = <STDIN>; chomp $r; return $r; }
That way, the input function does your chomping for you, and you don't need to litter chomp calls throughout your code.
In reply to Re: Chomping numbers?
by tobyink
in thread Chomping numbers?
by 7cardcha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |