Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Getting the line numbers of a multi-line match

by kcott (Archbishop)
on May 02, 2012 at 02:58 UTC ( [id://968353]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    int main(int argc, char** argv)
    
    /* END */
    
  2. or download this
    $ pm_multi_line_match.pl
    Match found on line 3
    Match found on line 6
    
  3. or download this
        print "Match found on line ",
                split(/\n/, substr $text, 0, pos $text) - split(/\n/, ${^M
    +ATCH}) + 1,
                "\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found