1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!/usr/bin/perl -w
use Data::Dumper;
use XML::XPath;
my $xml = new XML::XPath->new('test.xml');
#balise recherchée
my $rech = $xml->find("//title");
my @words;my @res;
if(my @nodes = $rech->get_nodelist){
@words = map($_->string_value, @nodes);
}
for(my $i=0;$i<2;$i++){
print "balise $i : $words[$i] \n";
if("$words[$i]" eq "Harry Potter"){
my $file = $words[$i];
print "ici file : $file\n ";
my $newfile = 'Harry Torpeur';
print "ici newfile : $newfile\n";
$ligne =~s/$file/$newfile/g;
print "c passé en douceur lol \n";
}
}
print "stop \n"; |