|
Well, assume something like this:
if
($tformat =~ /^[ymd]{1,4}([^ymd]{1})[ymd]{1,4}[^ymd]{1}[ymd]{1,4}$/i
or
$tformat =~
/^([ymd]{1,4})[^ymd]{1}([ymd]{1,4})[^ymd]{1}([ymd]{1,4})$/i)
{
}
Actually this is a weird example since I have accomplished with something
different what I needed. However I believe it would be good for me to know for a
future case if the short-circuit will avoid extra processing. As you can see, on
the second part of the OR I have three capturing parentheses which create $1,
$2, and $3 which are more expensive that just $1. The perldocs state that once
used, (in this case $2 and $3) they have to be provided for every match. So if
my program matches the left side OR it would not provide $2 and $3 to every
other regex, thus saving resources. I want to know if this is
true.
Regards,
Javier Moreno ...when you have eliminated the
impossible, whatever remains, however improbable, must be the truth.
|
Title: Message
