Robin Lavallee wrote:
: On the command lines, the following happend
:
: allo al => match
: allo /al/ => no match (should match, no ?)
No, because "allo" doesn't contain any slashes.
: allo lo$ => match
: allo ^al => match
: allo ^ao$ => no match (should match, no ?)
No. This expression would only match the string "ao".
I think what you mean is ^a|o$.
:
: Questions :
:
: - Why don't I need the regular expression delimiters (/), is it
: implicit when using
: variables ?
Apparently so, though I've never used it that way.
: - If I don't add them (/), will it still work for all cases ?
Again, apparently so, though I've never used them that way. One
advantage to using slashes (or any kind of delimiter with the "m"
operator; e.g., m{}, m::, etc) is that you can add options like "o",
which means "compile the regex just once" (m/$ARGV[0]/o). This can
speed things up if you're using the same regex to do a lot of
matching. ("o" has no effect if the regex is a constant expression.)
: - Why doesn't the last case work ?
See above.
-- tdk