in reply to fastest pattern match

Untested

#!/usr/local/bin/perl use strict; open( FILE, "file" ) || die $!; while( <FILE> ) { if( /regexp/ ) { print; last; } }

or better yet ( also untested )

perl -ne 'print, last if /regexp/' file

Replies are listed 'Best First'.
Re: Re: fastest pattern match
by neilwatson (Priest) on Jun 24, 2002 at 19:43 UTC
    last; that's the command I was trying to remember. Not exit. My head is filled with to much useless information.

    Neil Watson
    watson-wilson.ca