Hey Folks,

I see that my former posts have been moded up to where I am now a "monk". While I appreciate the honor, I have to say that I am truly not worthy of that title. I am a seeker, not a dispenser of perl wisdom. I will dispense once I've learned enough. So please mod away! ...down! :D

Well, it's true. Sadly, I have fallen off the Llama. In the past 3 weeks, I've had two valued family members die on me, had my place vandalized (on the day she dies with all kinds of ritualistic santa rea strangeness) and had a terrible session with my therapist.

But, sadly now that I am climbing back on the Llama I find that a lot of Perl knowledge has just sort of drained out of my mind. I am bummed. I want to get back to where I was and continue improving.

For some reason, my brain is so addled that I can't seem to make heads or tales of chp 9 ex 1 *OR* it's answer in the back of the book! god help me! :)

The question states that you should "Make a pattern that will match three consecutive copies of whatever is currently contained in $what. That is, if $what is fred, your pattern should match fredfredfred. If $what is fred|barney, your pattern should match fredfredbarney or barneyfredfred or barneybarneybarney or many other variations. (Hint: You should set $what at the top of the pattern test program with a statement like my $what = 'fred|barney' ;.)

The answer says here's one way to do it:

/(what) {3}/

Once $what has been interpolated, this gives a pattern resembling /(fred|barney){3}/. Without the parenthesis, the pattern would be something like /fred|barney{3}/, which is the same /fred|barneyyy/. So, the parenthesis are required.

Sorry for being so obtuse, but I can't seem to make heads or tales of this problem *OR* it's answer! You thoughts and comments would be appreciated!


In reply to Fell off the Llama by bluethundr

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.