🎴 Flashcard Mode
Perl Programming and Regular Expressions
Card1 / 20
Mastered0
Review0
QuestionClick to flip
my $txt = ‘I am learning Perl’; $txt =~ /(\w+)$/; print $1;
AnswerClick to flip back
A
Perl
💡 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.