Something like this?
my $add_at_end = 1; while( my $ln = <IN> ) { if( $ln =~ s/str1/str2/ && $add_at_end ) { $add_at_end = 0; } print OUT $ln; } print OUT "text" $add_at_end;
In reply to Re: Conditional replace
by lestrrat
in thread Conditional replace
by October
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |