Multiple choice technology programming languages

my $txt = ‘I am learning Perl’; $txt =~ /(\w+)$/; print $1;

  1. I am learning Perl

  2. I

  3. Perl

  4. l

  5. learning

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

The regex /(\w+)$/ captures one or more word characters at the end of the string. In 'I am learning Perl', the last word is 'Perl', so \$1 contains 'Perl' and it gets printed.