|
|
ru.perl- RU.PERL ---------------------------------------------------------------------- From : Ivan Frolcov 2:5020/400 22 Sep 2000 10:29:33 To : All Subject : Re: Spaces before and after -------------------------------------------------------------------------------- dimka kuvshinov <dmitriy@genphys.phys.msu.su> wrote in message news:8qdbia$785$1@host.talk.ru... > IF>> $& if m/(?:\w+\s+){1,4}SUBSTRING\s+(?:\w+\s+){1,4}/; > IF> $& лучше без особой нужды не дергать > > ничего не понял... print $& это совпадение с шаблоном поиска... или моя мысль > отстала на несколько шагов? perlfaq6: .... Why does using $&, $`, or $' slow my program down? Because once Perl sees that you need one of these variables anywhere in the program, it has to provide them on each and every pattern match. The same mechanism that handles these provides for the use of $1, $2, etc., so you pay the same price for each regex that contains capturing parentheses. But if you never use $&, etc., in your script, then regexes without capturing parentheses won't be penalized. So avoid $&, $', and $` if you can, but if you can't, once you've used them at all, use them at will because you've already paid the price. Remember that some algorithms really appreciate them. As of the 5.005 release. the $& variable is no longer ``expensive'' the way the other two are. ... --- ifmail v.2.15dev5 * Origin: Moscow State University (2:5020/400) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.perl/5486dadff408.html, оценка из 5, голосов 10
|