Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Finding the second line an item appears on

by monktim (Friar)
on Oct 27, 2003 at 18:48 UTC ( [id://302471]=note: print w/replies, xml ) Need Help??


in reply to Finding the second line an item appears on

The other answers look good if formulae is guaranteed to exist on at most 1 line at a time. If it can appear twice on the same line, this will work.
use strict; my $i; while (<DATA>) { my @m = ($_ =~ /formulae/g); $i += @m; } print "Found $i matches\n"; __DATA__ message one message two formulae formulae message threee

Log In?
Username:
Password:

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

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

    No recent polls found