> >my $word = "WORD"; > > > >while (<>) { > > s/$word/lie/g; #Slow > >} > > > >is slow because that $word forces the regex to > >be recompiled each time through. The best way > >to solve this problem is to create a Perl > >script on the fly and run using eval $script; > > Not true about that regex. Here is a comparison: > [snip]
True Japhy. AFAIK Perl would evaluate $word each time in other to check that the regex is unchanged. That doesn't count as the really slow action of recompiling, but is still additional time... that is, unless the JIT optimiser pulls that case out. Does it? Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]