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

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

  • Comment on •Re: Re: •Re: Re: •Re: A pattern that matches three consecutive copies...
  • Download Code

Replies are listed 'Best First'.
Re: •Re: Re: •Re: Re: •Re: A pattern that matches three consecutive copies...
by WarrenBullockIII (Beadle) on Jun 09, 2002 at 16:23 UTC
    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