Jumping first to your question about the existance of a $wizardextract -- well, yes there is: namely, use of elements enclosed by simple parentheses (eg  /(foo) bar (bat)/ inside the regex (more on this below)

perl -e "my $str='foo bar bat'; if ($str =~ /(foo) bar (bat)/ ) {print + \"\$1: $1; \$2: $2)\"; }" $1: foo; $2: bat)
Note 1: 'Doze quoting
Note 2: Other uses of parens exist but are outside the scope of your question.

The parens INSIDE the regex -- that is, between the forward slashes -- tell Perl to capture the elements they enclose (when matched) to the special $n variables. The only parens I found in the first half dozen pages of the text you referenced (TL, DRIA) are those required in the if (...) clause which may be a source of your misunderstanding.

Switching topics: you object to the author invoking chomp before introducing it. That's perhaps pedagologicly sound, but it also misses (missed?) a critical lesson about learning Perl!

You can use your command line and Perl's own documententation to understand (or at least get an introduction to) Perl functions. Here's an example:

perldoc -f chomp chomp VARIABLE chomp( LIST ) chomp This safer version of "chop" removes any trailing string t +hat corresponds to the current value of $/ (also known as $INPUT_RECORD_SEPARATOR in the "English" module). It retur +ns the total number of characters removed from all its arguments. + It's often used to remove the newline from the end of an input +record ....

HTH

Update: fixed last closing code tag's missing < before the slash-c. TY, many times over, to choroba & hippo


In reply to Re: exist backreference variable list? by ww
in thread exist backreference variable list? by PerlJam2015

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.