in reply to •Re: Re: •Re: A pattern that matches three consecutive copies...
in thread A pattern that matches three consecutive copies...

Yes actually I am getting it to say no match. Thats what I expect it get too! So I guess I don't uderstand the question in the book then...
  • Comment on Re: •Re: Re: •Re: A pattern that matches three consecutive copies...

Replies are listed 'Best First'.
•Re: Re: •Re: Re: •Re: A pattern that matches three consecutive copies...
by merlyn (Sage) on Jun 09, 2002 at 16:08 UTC
    Three consecutive copies of the regex fred|barney would be like:
    fredfredfred fredbarneyfred barneybarneybarney
    and so on. Put one of those as your string on the left of the =~ operator, and it'll match!

    -- Randal L. Schwartz, Perl hacker

      ok well the way I understood the question was totally oposite of that... sorry:-) So the point to question 1 in chapter nine is that you can use the contents of a variable as the pattern instead of typing out an actual pattern? so for example:
      barneybarneybarney =~ /($what){3}/
      would match the string because the variable contains the contents of the string barneybarneybarney ??? Sorry if I'm being a pain in the neck but I just want to make sure I fully understand this before I move on to chapter 10.
        Well, as a quoted string, yes. Putting it bare like that might work for this one precise example, but will bite you later.

        -- Randal L. Schwartz, Perl hacker