Multiple choice technology programming languages

Which of the following commands will turn a scalar ($str)into an array of characters?

  1. @a = split($str).
  2. @a = split(/\s/, $str).
  3. This task can be done in Perl but none of the above commands do it.

  4. @a = split(/./, $str).
Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

None of these commands correctly split a scalar into characters. split($str) lacks a pattern, split(/\s/, $str) splits on whitespace, and split(/./, $str) uses '.' as a regex meta-character matching any character. The correct syntax is split(//, $str) or split('', $str).