1. use chomp instead of chop
2. don't calculate things that are not needed or used (get rid of statements before the prints).
3. follow the spec: just print result., e.g. print $x+$y,"\n";
4. if..elsif is fine to "shortcut" number of statements executed.