in reply to finding the last occurence of substring in string

The position of the (first of) last 2 non-? bytes that are followed exclusively by ?s to the end of the string:

$s =~ m[([^?]{2})[?]+$] and print $-[0];; 8

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: finding the last occurence of substring in string
by gri6507 (Deacon) on Jul 26, 2012 at 16:28 UTC
    Thanks, the match operator gets me what I was looking for. But your post brings up another question. What is the meaning of $-[0] ?
      What is the meaning of $-[0] ?

      See the definition of @LAST_MATCH_START in perlvar.

      $-[0] is the value of the first element of @-. Which, after a successful match, contains the position in the string at which the capturing parens matched.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?