in reply to if elsif elsif prints all three.

} elsif ( $line =~ m/best1collect/) { next;

This will omit lines containing 'best1collect' from the input file. Instead I think what you want is to set a flag so that later when you see 'syslogd' you do not insert the bgs stuff. Is that what you want to do?

Replies are listed 'Best First'.
Re^2: if elsif elsif prints all three.
by wcj75019 (Acolyte) on Feb 27, 2008 at 21:23 UTC
    Yes if =~ m/bestcollect/ That means the line is ok. So, leave it alone. if there is no $line. Then insert the here documnet $bgs before 'syslogd' Thanks
Re^2: if elsif elsif prints all three.
by wcj75019 (Acolyte) on Feb 27, 2008 at 21:30 UTC
    I want it to do nothing if the $line has /bestcollect/ It prints every if elseif. I want it to just do one thing. If the line is wrong. fix it. If it isn't there print the $bgs stuff. Thanks,