in reply to defined ? to be : not
Minor note; that chomp ; isn't working.
If you had used warnings, perl would have told you. You probably want chomp $input; instead.