in reply to Looking for less code

You can probably reduce the code more if you know more about the context, and the content of the file you are reading. There's an easy reduction of the line count if you use statement modifiers. Using $_ instead of $line reduces the amount of code as well:
local $_; while (<DATA>) { print if /WNT|UNX/; if ($flag) { print if $target_db eq 'sql' && /informix|oracle/i || $target_ +db ne 'sql' && /$target_db/i; print $FH $_; undef $flag if /$target_os/; } elsif (/UNX|WNT|COMPONENT/) { $flag = 1; print $FH $_; } }