Multiple choice technology programming languages

$string = "Hello World"; substr($string,6)="Perl"; print $string;

  1. Hello Perl

  2. Hello Perl World

  3. Hello

  4. Perl World

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

In Perl, substr() can be used as an lvalue (left side of assignment). substr($string,6) refers to position 6 onwards in the string. In Hello World, position 6 is 'W', so assigning Perl to that position replaces World with Perl, yielding Hello Perl.