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"
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.#!/usr/bin/perl `perl -ni -e 'print; print "adding value=key\n" if $.==3' myfile.txt`; + #from command prompt its works fine
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problem in executing the perl oneliner within the script
by kcott (Archbishop) on Feb 25, 2014 at 08:48 UTC | |
by perladdict (Chaplain) on Feb 25, 2014 at 12:26 UTC | |
by kcott (Archbishop) on Feb 25, 2014 at 16:57 UTC | |
by 2teez (Vicar) on Feb 25, 2014 at 13:32 UTC | |
by kcott (Archbishop) on Feb 25, 2014 at 16:09 UTC | |
Re: Problem in executing the perl oneliner within the script
by 2teez (Vicar) on Feb 25, 2014 at 08:39 UTC | |
Re: Problem in executing the perl oneliner within the script
by Anonymous Monk on Feb 25, 2014 at 08:22 UTC |
Back to
Seekers of Perl Wisdom