in reply to Re: Return value from a binding operator?
in thread Return value from a binding operator?

Really useful, thanks.

I'd worked out that /? meant "optional /" (though not why that was relevant) but, as an absolute Perl beginner, I had assumed that the caret slash (^/) meant "a line beginning with a slash" (still not sure why it doesn't), which didn't make any sense, so I obviously need to get to grips with that.

Lots to learn....

Chris
  • Comment on Re^2: Return value from a binding operator?

Replies are listed 'Best First'.
Re^3: Return value from a binding operator?
by dsheroh (Monsignor) on Apr 13, 2013 at 09:50 UTC
    The ^ metacharacter has different meanings in different parts of a regex.

    Normally, it does mean "start of line", as you thought. If the regex were m!^/!, then it would match lines beginning with /.

    However, as the first character in a character class, it negates the class, so [^/] means "match any character except /". (But, again, that's only if it's the first character in the class - [/^] means "match either a / or a ^". And [^/^] would match any character except those two.)