Multiple choice technology programming languages

$val = 'a\b\n';print $val;What gets printed?

  1. ab(newline)

  2. a\b(newline)

  3. a\b\n

  4. a\b(newline)

  5. a\b\n

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

In single quotes, Perl does NOT interpret escape sequences except for \ and \'. The string 'a\b\n' contains a literal backslash-backslash, 'b', and literal backslash-n. When printed, this outputs exactly: a\b\n (no newline character, just the characters). The double backslash becomes one backslash in output.