Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Returning line numbers of a string

by pvaldes (Chaplain)
on Aug 13, 2012 at 17:31 UTC ( #987167=note: print w/replies, xml ) Need Help??


in reply to Returning line numbers of a string

open my $file, '<', "myfilename"; while (<$file>){ next unless /mystring/; print "string found at line $."; } close $file;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987167]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2017-07-20 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (316 votes). Check out past polls.