I have this text in file 1:
printf ("integer value is %x \n", a);
I want to read data from file 1 and write into file 2.
When I reach this particular line, file 2 appears like this:
printf ("integer value is 0 \n", a);
Why does it happen? How can I avoid this?
This is how my Perl code looks:
while ($line = <$in_fh>) {
printf $out_fh $line;
}
Here, $in_fh and $out_fh are in & out file handles.
Because
printfinterprets$lineas a format string, and finds%xwhich looks like a token. Useprintinstead.