in reply to exist backreference variable list?

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

Replies are listed 'Best First'.
Re^2: exist backreference variable list?
by PerlJam2015 (Novice) on Jan 09, 2015 at 22:01 UTC

    Thank you for your response, ww. The book in chapter 5 in fact covers how to write the regular expression to search data with grouping, and later  print it. I realize now how vague I was being in the question and have changed it to reflect that the regular expression will not be hardcoded, but be <STDIN>

    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!

    To be specific he requests, in chapter 3 that you

    3. Store your important phone numbers in a hash. Write a program to look up numbers by the person's name.

    I assumed values from <STDIN> would just match, and up till that point chomp isn't mentioned nor is the fact that the <STDIN> function throws in a /n at the end of every entry. I was bashing my head against the wall when the hash wasn't matching the entry, even if (so far as I could tell) it matched verbatim. It was only after pouring over the nodes here for awhile that I discovered the chomp function and what it did.

    That being said, I'm sort of glad it happened. It forced me to reach out and do some (?=) as you mentioned.