Multiple choice technology programming languages

To copy entire matched sequence

  1. $&
  2. $%
  3. $_
  4. $@
  5. $^
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In regex replacement patterns, $& represents the entire matched string. $%, $_, $@, and $^ are special variables in Perl/regex but don't copy the matched sequence - they have other meanings. $& is specifically designed to reference the complete match.

AI explanation

In Perl regex matching, \$& is a special variable that always holds the entire text that was matched by the last successful pattern match, regardless of any capture groups. The other symbols (\$_, $@, $^, $%) are used for different purposes — the default variable, the last eval error, formatting/output variables — and none of them hold the matched substring.