Multiple choice technology programming languages

Your script has just read in a variable from the keyboard and you want to strip that variable of the newline character that came in. What operator should you use to perform this operation?

  1. tidy

  2. trim

  3. chomp

  4. slim

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The chomp operator in Perl is specifically designed to safely remove the trailing newline character (or input record separator) from a string variable.