Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: regex/extracting whole lines

by CubicSpline (Friar)
on Oct 19, 2001 at 16:49 UTC ( [id://119965]=note: print w/replies, xml ) Need Help??


in reply to regex/extracting whole lines

Is something like this what you're after:
use strict; open IN, "filename" || die "Couldn't open file!"; my $line,$i; my $n = 5; #how many lines after the **line** to get my $emailtext = ""; while( chomp($line = <IN>) ) { #if line has ** in it, then get next n lines if( $line =~ /\*\*/) { for my $i (1..$n) { $emailtext .= <IN>; } #send your email here } }

HTH
~CS

Log In?
Username:
Password:

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

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

    No recent polls found