in reply to regex for Err operator.

the actual problem aside, my first thought is to use a different delimiter to make a little more legible (avoid having to escape the slashes):
s#(.*\s*)(.*)\b\s*//\s*(.*)\b#$1defined($2) ? $2 : $3#gm;
Second thought is that at least some (if not most) of the * (0 or more) should be + (1 or more). Without them, the regex will match just the string "//".

also, should "$1defined" be "$1 defined" ?

Replies are listed 'Best First'.
Re^2: regex for Err operator.
by Anonymous Monk on Aug 23, 2005 at 18:32 UTC
    Hi, Thanks for your reply. The Err operator is a Binary operator in perl6 and it is //. A binary // operator is the defaulting operator. That is: $a // $b is short for: defined($a) ? $a : $b Because this operator is very useful Iam writing a source filter. Thanks, Raga