welcome to Perl and to the monastry PerlJam2015!

First: dont waste time with a very outdated book! there are some good and recent books about Perl. Some years ago i was in your same situation: first programming language and a very empiric computer experience. The problem you are experiencing is "how to assimilate the syntax" and Perl is a bit hard to approach, like the easter lunch, but as your stomach (mind?) get adapted, you got more and more hungry and you'll see a perlish way to get the job done.

Because of this let me suggest you some different reading. Exists a good book that illustrate in a very effective way the Perl's panorama. I'm talking about 'Perl Cookbook'. May seems a nonsense because that book too is somehow aged. But is perfect Perl 5 even if not so modern. But the cookbook approach separated in meaningful chapter was something invaluable for me.

You preferably get your copy of the free Moder Perl book or read it online. This book is a little harder than cookbook but is full of gems and explication of concepts you dont find in other book (defaults, context, coercion..) and is moder: id est it explains all new features of the language. Take that books together and dont forget the official documentation for function reference, tutorials, core modules docs..

Now something about your question.
Yes, when there are grouping parens in a regular expression Perl automatically put each resulting part in the special variable $<digits> ($1, $2, ...), and yes you can get all results into an array:
perl -e "$ARGV[0] =~ /(a)(l)(l)/; print qq($1 $2 $3) " alltogether #out:a l l perl -e "@array = $ARGV[0] =~ /(a)(l)(l)/; print qq(@array) " alltoge +ther #out:a l l


Regexes can do many many things and is a language inside another. Most of times you'll need only basic features of regexes.

As last tip to learn a good Perl is to pay attention to idioms: prooved and safe ways to do some task in Perl. Perl as one motto that states: 'There is more than one way to do it' (aka TIMTOWTDI or Tim Taody for closer friends..). As you learn more and more the language you tend to write perlish and idiomatic Perl. Some idiom is illustrated here in the tutorials section of the monastery, others in Modern Perl book mentioned above.

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: exist backreference variable list? by Discipulus
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.