
shanaka
New User
Nov 8, 2012, 9:58 AM
Post #1 of 5
(886 views)
|
Getting Error when I try to write special string to file. Modification of a read-only value attempted
|
Can't Post
|
|
hi Guys, I am trying to write string to a file with special characters . I am getting error , "Modification of a read-only value attempted.. " program is like this, #!/usr/bin/perl my $file = "sample.txt"; my $special_string = "%a %t %m %f %s %B %T %n"; print "**".$special_string."\n"; open TXTFILE, ">$file"; printf TXTFILE $special_string."\n"; close TXTFILE; Out put and error is, **%a %t %m %f %s %B %T %n Modification of a read-only value attempted at ./test.pl line 10. Apriciate anyone can help me to solve the issue. Thanks, Shanaka
|