Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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


#!/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
Replies are listed 'Best First'.
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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2015-11-28 05:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls