Workshop
If you've started to figure out the pattern to regular expressions, try this quiz to see what you've learned.
Quiz
1: | If you have lines formatted "x=y", what expression would swap the left and right sides of the expression?
|
2: | After this code, what's the value in $2?
$foo="Star Wars: The Phantom Menace"; $foo=~/star\s((Wars): The Phantom Menace)/;
|
3: | What does the pattern m/^[−+]?[0–9]+(\.[0–9]*)?$/ match?
|
Answers
A1: | a. Choice c doesn't include the = symbol in the replacement string ... |
Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.