undef $/; open(IN, "< 1.txt") ; $str = <IN>; close(IN); $str =~ s#\n(.+?)\n#\n\$exec \= \$ENV\{EXEC\}\n$1\n#gsi; open(OUT, "> 2.txt") ; print OUT $str; input: ********* hai this is the test input sample output: ********** hai $exec = $ENV{EXEC} this is $exec = $ENV{EXEC} the test $exec = $ENV{EXEC} input sample
In reply to Re: insert line in between two lines
by perlsen
in thread insert line in between two lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |