http://www.perlmonks.org?node_id=1076103

perladdict has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks
I have a perl oneliner which will add a line to the exisiting file after the 3 line, when i run this command from the command prompt it is perfectly adding a line, but when include the same command in script it is displaying error as "(might be runway multi-line " " starting on line 1) and execution -f -e aborted due to compilation error"
#!/usr/bin/perl `perl -ni -e 'print; print "adding value=key\n" if $.==3' myfile.txt`; + #from command prompt its works fine
Even i tried to assing this command to variable and tried to execute by system($cmd) still getting the same error, please correct my mistake.