Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: fastest pattern match

by lestrrat (Deacon)
on Jun 24, 2002 at 19:38 UTC ( #176913=note: print w/ replies, xml ) Need Help??


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


Comment on Re: fastest pattern match
Select or Download Code
Re: Re: fastest pattern match
by neilwatson (Curate) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://176913]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-17 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls