Loading ...
Sorry, an error occurred while loading the content.

qr

Expand Messages
  • kapil v
    What is the difference between these two expressions? $pat=qr/some_regex/; How is /{$pat}xxx/ and /${pat}xxx/ different? Thx. I know Karate, Kung fu and 47
    Message 1 of 3 , Jun 1, 2007
    • 0 Attachment
      What is the difference between these two expressions?

      $pat=qr/some_regex/;
      How is /{$pat}xxx/ and /${pat}xxx/ different?

      Thx.


      I know Karate, Kung fu and 47 other dangerous words.


      ---------------------------------
      New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes.

      [Non-text portions of this message have been removed]
    • Jenda Krynicky
      From: kapil v ... Try that! The first one would look for an opening curly brace followed by whatever the some_regex matches followed by
      Message 2 of 3 , Jun 1, 2007
      • 0 Attachment
        From: kapil v <aaaaax2003@...>
        > What is the difference between these two expressions?
        >
        > $pat=qr/some_regex/;
        > How is /{$pat}xxx/ and /${pat}xxx/ different?

        Try that!

        The first one would look for an opening curly brace followed by
        whatever the some_regex matches followed by closing curly and 'xxx',
        the second would match whatever some_regex matches followed by 'xxx'.

        You should keep in mind that $variable and ${variable} means exactly
        the same and that {} is only special in a regexp if it contains a
        number, number and a comma, comma and a number or two numbers
        separated by commas. (In which case if specifies the exact, maximum,
        minimum and range of occurences of the item preceding the openning
        curly.

        Jenda
        ===== Jenda@... === http://Jenda.Krynicky.cz =====
        When it comes to wine, women and song, wizards are allowed
        to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery
      • kapil v
        Oh! I see . thx Jenda Krynicky wrote: From: kapil v ... Try that! The first one
        Message 3 of 3 , Jun 4, 2007
        • 0 Attachment
          Oh! I see .

          thx

          Jenda Krynicky <Jenda@...> wrote: From: kapil v <aaaaax2003@...>
          > What is the difference between these two expressions?
          >
          > $pat=qr/some_regex/;
          > How is /{$pat}xxx/ and /${pat}xxx/ different?

          Try that!

          The first one would look for an opening curly brace followed by
          whatever the some_regex matches followed by closing curly and 'xxx',
          the second would match whatever some_regex matches followed by 'xxx'.

          You should keep in mind that $variable and ${variable} means exactly
          the same and that {} is only special in a regexp if it contains a
          number, number and a comma, comma and a number or two numbers
          separated by commas. (In which case if specifies the exact, maximum,
          minimum and range of occurences of the item preceding the openning
          curly.

          Jenda
          ===== Jenda@... === http://Jenda.Krynicky.cz =====
          When it comes to wine, women and song, wizards are allowed
          to get drunk and croon as much as they like.
          -- Terry Pratchett in Sourcery






          I know Karate, Kung fu and 47 other dangerous words.


          ---------------------------------
          Yahoo! Answers - Got a question? Someone out there knows the answer. Tryit now.

          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.