Multiple choice technology programming languages

$string = “GoodWorld”; $string =~ s/o*/i/; The value of $string is?

  1. iGoodWorld

  2. GidWirld

  3. GidWorld

  4. Gioworld

  5. GoodWorld

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

The regex o* matches zero or more o's. In GoodWorld, the pattern matches at position 0 with zero o's (the * allows zero matches). The substitution i replaces this zero-length match, inserting i at the beginning. Result: iGoodWorld.