Challenge 3: Rewrite with /x — Possible Solution ==================================================================== Original: /^(\w+)@(\w+\.\w+)$/ Rewritten with /x: my $email_pattern = qr/ ^ ( \w+ ) # the username part, before the @ @ ( \w+ \. \w+ ) # the domain part: word characters, a literal dot, more word characters $ /x; use strict; use warnings; use feature 'say'; my $email = "ada\@example.com"; if ($email =~ $email_pattern) { say "Username: $1, Domain: $2"; } Output: Username: ada, Domain: example.com WHY THIS WORKS AS AN ANSWER ------------------------------ The rewritten pattern reuses every piece of the original regex completely unchanged in MEANING — ^, (\w+), @, (\w+\.\w+), and $ all still mean exactly what they meant before — only the FORMATTING changed, per the chapter's own description of what /x actually does: it "ignores whitespace... and allows # comments," not a different matching behavior. Each significant regex token is placed on its own line, reusing the chapter's own multi-line /x layout from its job-reference-pattern example, with a # comment (also reused directly from that same example) explaining what each piece is responsible for — the username part, the literal @, and the domain part. The \. inside ( \w+ \. \w+ ) keeps its backslash escape exactly as in the original — the chapter's own warn-box-adjacent point that only whitespace is ignored under /x, not the actual regex metacharacters themselves, so \. still means "a literal dot" and not "any character," exactly as it did in the original single-line version. Testing both against the same email confirms the rewrite is behavior- preserving: $1 and $2 populate with "ada" and "example.com" exactly as the original, unformatted pattern would have produced.