Sam wrote: > > --- Rob Dixon <[EMAIL PROTECTED]> wrote: > > Sam wrote: > > > > > > But I'm not sure which is faster though. > > > > If you don't know, it doesn't matter. > > > > If your software is /too/ slow and you would die for a 10% speed increase > > then > > check out > > > > use Benchmark; > > > > If not, don't bother. > > No it hums along fine. But using eval was *really* slow and clearly I was on > the wrong track using it.
It depends on how you use eval. :-) Instead of using eval inside of a loop it is a lot faster if you eval the whole loop. # slow my $expr = '/$regex/'; while ( <FILE> ) { if ( eval $expr ) { do { something() }; } } # a lot faster my $loop = <<'LOOP'; while ( <FILE> ) { if ( /$regex/ ) { do { something() }; } } LOOP eval $loop; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>