in reply to Re: insert line in between two lines
in thread insert line in between two lines

here is what to i needed specifically
$cwd = cwd();
print"$cwd\n";

i want the following
$cwd = cwd();
$exec = $ENV{EXEC}
print"$cwd\n";

i am sorry for not giving detail earlier

Replies are listed 'Best First'.
Re^3: insert line in between two lines
by prasadbabu (Prior) on Mar 16, 2005 at 11:56 UTC

    This might work for you.

    undef $/; $a = <DATA>; $nline =q($exec = $ENV{EXEC};); $a =~ s/\n([^\n]+)/\n$nline\n$1/s; print "$a"; __DATA__ $cwd = cwd(); print"$cwd\n";

    Prasad