while ( my $line = ) { print OUTPUT "das ist der text \n" if $line =~ /testende/; print OUTPUT $line; }