|
|
ru.perl- RU.PERL ---------------------------------------------------------------------- From : Vladimir Bukreev 2:5035/21.35 14 Apr 2000 23:15:45 To : All Subject : Объясните кусок из книги. --------------------------------------------------------------------------------
Субж (это про оптимизацию скриптов):
=*= Здесь начался 1.txt =*=
Avoid run-time-compiled patterns. Use the /pattern/o (once only) pattern
modifier to avoid pattern recompilation when the
pattern doesn't change over the life of the process. For patterns that
change occasionally, you can use the fact that a null
pattern refers back to the previous pattern, like this:
"foundstring" =~ /$currentpattern/; # Dummy match (must succeed).
while (<>) {
print if //;
}
You can also use eval to recompile a subroutine that does the match (if
you only recompile occasionally).
=*= А здесь он закончился =*=
Меня интересует значение параметра o, а также как именно юзать 2-й метод.
Со 2-м способом я пробовал что-то типа:
$tmp=~/(\d\d):(\d\d):(\d\d)/;
$tmp2=~//;
Дык нифига... или криво пробовал.
Vlad Hо примчались санитары и зафиксировали нас!
True BBS - 563544 - 20:00-07:00
Quake Clan [BIA]
--- Пожиратель золота пробы 1.1.1.2
* Origin: Поделись улыбкою своей :) (2:5035/21.35)
Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.perl/330838f7a74a.html, оценка из 5, голосов 10
|