Sean Sugrue wrote:

> Can anyone help me,
> 
> I am trying to pick up the text on the next line if the line before it has
> a "description" tag.
> 
> while(<input_file>
> {
>   if( /description/i ){
>    @array = nextline in the file;
> some processing here}
> 
>    }
> 
> 
> ##############################
> 
> But it would even be better if
> 
> ############################## 
> 
> while(<input_file>
> {
>  if( /test_function/i){
>   next line until if( /description/i ){
>    @array = nextline in the file;
> some processing here;}}
> 
>    }

try something like:

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

open(INPUT_FILE,$input_file) || die $!;
while(1){
        my $line = <INPUT_FILE>;
        last unless(defined $line);
        next unless($line =~ /description/i);
        my $next_line = <INPUT_FILE>;
        #-- do something with $next_line
}
close(INPUT_FILE);

__END__

david

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

Reply via email to