pushkar.n...@gmail.com wrote:
Hi,  I have a line read in perl from a file that itself is a source
code for languages like c/sv etc. The variable containing this line
contains special characters like %d. When i print this line to another
file, the %d is evaluated and a 0 is getting printed. How do i
overcome this and tell perl to strictly not interpolate/evaluate any
contents of this variable and simply print it as is !
~Pushkar

open RFH "< File1.txt";
open WFH "> File2.txt";

while ($line = <RFH>)
{
      chop($line);
      printf WFH "$line\n";
--------^^^^^^

Use print(), not printf().

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to