On Jun 24 2001, Brett W. McCoy wrote:
> m//g *does* return the number of matches
> if you use it in the correct context (as we have already discussed to
> death...).

        I'm a Perl newbie that has just joined this list to aid me in
        my Perl education and, following this discussion, I think that
        I have two questions:

        1 - How does the Perl grammar interprets the following statements:

            $n = () = m/string/g;

            In particular, is "()" an lvalue in Perl?

        2 - Why does the following snippet prints 3 and not 4?

            $_ = "ana e mariana gostam de banana";
            $n = () = m/ana/g;
            print "$n\n";

            Perl seems to not be finding occurences of overlapped
            patterns (as I would expect from the implementation of a
            Boyer-Moore algorithm -- which I read somewhere that Perl
            uses when dealing with simple patterns).

        Any help will be very much appreciated.


        Thank you very much, Roger...

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Rogério Brito - [EMAIL PROTECTED] - http://www.ime.usp.br/~rbrito/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply via email to