Martin A. Hansen wrote:
> im wondering how i can make a subroutine that will return all text
> lines between certain marks such as START and STOP:

Here's simple way to do it. It uses the '..' operator (see perldoc
perlop for more info about it).

Note that if START and STOP are in the same line, it will only print
this line. If you want to force START and STOP to be on different lines,
try using the '...' operator.

#!/usr/bin/perl -w
use strict;

my $start = 'START';
my $stop  = 'STOP';

while (<DATA>){
        print if /$start/ .. /$stop/;
}

__DATA__
text
is here
and there
START
text
is here
and there
is
a
lot of it
STOP
text
is here
and there
__END__

-- 
briac
 << dynamic .sig on strike, we apologize for the inconvenience >>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to