Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Printing line before matching expression

by jaredor (Priest)
on Sep 11, 2013 at 18:56 UTC ( #1053549=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    use Modern::Perl;
    ...
    caz
    ciz
    cuz
    
  2. or download this
    my $lbl; # lookback line
    while ($buff[$.%($lb+1)] = ($_ = <DATA>)) {
        print $lbl if $lbl = $buff[($.+1)%($lb+1)] and /$match/;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2021-03-04 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (97 votes). Check out past polls.

    Notices?