Multiple choice technology programming languages

What will be the value of $str ? my $str = '112133'; $str =~ s/(.)\1/$1/g;

  1. 112133

  2. 1233

  3. 1213

  4. 12133

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

The regular expression (.)\1 matches any single character followed by an identical character (a duplicate pair). The substitution replaces each pair with a single occurrence of that character. Thus, '11' becomes '1' and '33' becomes '3', yielding '1213' (596764).