in reply to Re^2: What it mathches`
in thread What it mathches`

Reading perlre, I see this:

  1. \ Quote the next metacharacter
  2. ^ Match the beginning of the line
(Emphasis mine.) It then goes on to say:
By default, the "^" character is guaranteed to match only the beginning of the string, the "$" character only the end (or before the newline at the end), and Perl does certain optimizations with the assumption that the string contains only one line.
(Emphasis still mine.) That's where I got the "optimisation" part. As to $*, I'm using perl 5.8. The OP didn't mention version of perl, and I've not been paying attention to his posting history to note what version he's been using, so felt free to use whichever perl I had handy.

Replies are listed 'Best First'.
Re^4: What it mathches`
by ikegami (Patriarch) on Aug 17, 2009 at 15:51 UTC

    I'm missing your point. Nothing here contradicts what I said, and I don't see how anything here relates to what I said.

    so felt free to use whichever perl I had handy.

    That's fine (although it gives an error in 5.8.8). That's why I said "by the way". The goal was to discourage anyone from thinking it was acceptable to use it. It's buggy when used in conjunction with qr// and perhaps other features.

      I think we're talking across each other. You said, "No assumption was made." I pointed out where the perl documentation shows that ^ assumes, without the /m flag, that there is only one line as an optimisation, which runs contrary to there being "]n]o assumption ]...] made". You said "$* doesn't exist anymore." I had originally described $* as deprecated twice, and said not to use it twice, so I wasn't sure why it needed further pointing out other than perhaps to say that it doesn't exist in 5.10 at all, so I merely pointed out why it worked for me: I'm using perl 5.8.8.

        I pointed out where the perl documentation shows that ^ assumes, without the /m flag, that there is only one line as an optimisation, which runs contrary to there being "]n]o assumption ]...] made".

        I have no idea what that optimisation is, but how the regex engine optimises is well outside the topic of this thread. Any assumption it made affects performance, not result, so I don't know why you think I made an assumption.