Perl parse error

Hello there,

I em executing the following command in a perl script to append "\0" to the end of every line in a file:

###command start
my $cmd = qx{"C:\\gawk" '{print $0 "\\\0"}' C:\file.txt > C:\file_1.txt};
###command end

But i get the following error:

###error meaasge start
gawk: cmd. line:1: {print C:\LOC\line.pl \0}
gawk: cmd. line:1:              ^ parse error
###error meaasge end

I executed the same command in the command line and it worked fine for me. Please help. Thanks in advance.

perl -lne 'print $_,"\0"' yourfilename

tyler_durden

Thanks durden_tyler. I will try your suggestion too. I could fix the issue. Below is the change \$0.

my $cmd = qx{"C:\\gawk" '{print \$0 "\\\0"}' C:\file.txt > C:\file_1.txt};