2010/1/19 harish behl <harish_behl1...@yahoo.com>: > My Script has to search a particular string like "\$Header\$" in files and if > this string is found, it should replace it with "\$Header > $NameofFile 01/01/2009". But it's making the files blanks.
This means you have a problem in the part that is writing to the files, mainly here: > foreach my $line (@lines) You correctly assign each element from @lines to $line, but, the substitution and print are made on the default variable ($_): > s/$var/\$Header: $fname 120.0 2007\/11\/27 07:59:52 atgops1 noship > \$/; > print WRITEFILE $_; Which means the substitution doesn't happen and the file's getting overridden with whatever's in the default variable, in your case, apparently nothing. There are several other issues of correction and practice in your program, and I do encourage you to uncomment 'use strict' in your second line, but I believe that's the immediate solution to your issue. -- Erez "The government forgets that George Orwell's 1984 was a warning, and not a blueprint" http://www.nonviolent-conflict.org/ -- http://www.whyweprotest.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/