in reply to inserting few lines after matching a string?


And your question is...?
open (IN, 'file.txt'); open (OUT, '>output.txt'); while (<IN>) { print OUT $_; if (/^printf\("hello boddy...."\);\s*$/) { print OUT qq{char *point = new char[10];\n}; print OUT qq{printf("complete..\n");\n}; } } close OUT; close IN;

#!/usr/bin/perl -i -p # perl foo.pl file.txt if (/^printf\("hello boddy...."\);\s*$/) { $_ .= qq{char *point = new char[10];\n} . qq{printf("complete..\n");\n}; }

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq