Perl script does not work



Folk
I am trying hard to run this script on fedora 3

It changes the following pattern in xml files

<!CDATA[slaaam]]> TO

<slaaam>

But it does not work. Any reasons


The script is a as follows

#!/usr/bin/perl
use strict;
use warnings;
my $start_dir = "/home/amjad/chatTrackBot_v1.5/xml_logs";
chdir($start_dir) or die "Can't chdir $start_dir: $!";
my @files = <*.xml>;
my @errors = ();
foreach my $file ( @files ) {
open(OLD, "<$file") or push @errors, "failed to open $file: $!";
open(TEMP, ">temp.txt") or push @errors, "failed to create temp
file: $!";
while (my $line = <OLD>) {
$line =~ s/<!\[CDATA\[([^\]]*)\]\]>/$1/ig;

print TEMP $line;
}
close OLD;
close TEMP;
rename('temp.txt', $file) or push @errors, "Rename failed: $!";
}
if (@errors) {
print "$_\n" for @errors;
}
else {
print "No errors";
}

.



Relevant Pages

  • Re: Perl script does not work
    ... I am trying hard to run this script on fedora 3 ... It changes the following pattern in xml files ... Any reasons ...
    (comp.lang.perl.misc)
  • Re: Continue on Mysql error
    ... > I've an insert statement that takes datas from XML files. ... > some reasons, ... I won't my script to stop. ... <?php echo 'Just another PHP saint'; ...
    (comp.lang.php)
  • Continue on Mysql error
    ... I've an insert statement that takes datas from XML files. ... some reasons, ... crashes and it doesn't continue, even if the following items are ok. ... How to let the script continue, even if there is an "insert" error (or any ...
    (comp.lang.php)
  • Help making this script better
    ... I am using Python 2.4, ... can use this script. ... # This sciript will process a directory of XML files and push them to ... def getFiles2Post: ...
    (comp.lang.python)
  • Re: Schedule Ruby Code!
    ... this list in a generated XML files, ... schedule this script to run every 30 minutes. ... script run every 30 minutes, I'm new to the language I liked it and I ... If you want to stay Ruby, you can use the OpenWFEru scheduler and ...
    (comp.lang.ruby)