Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Grepping with Perl: How to stop after first match?

by dragonchild (Archbishop)
on Dec 06, 2007 at 01:49 UTC ( [id://655273]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub first (&@) {
      my $code = shift;
    ...
    
      undef;
    }
    
  2. or download this
    open my $fh, '<', $filename or die "Cannot open '$filename' for readin
    +g: $!\n";
    tie my @arr, 'Tie::Array::Lazy', [], sub { scalar <$fh> };
    
    first { <whatever> } @arr;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found