# Questo è il file data.xml:
<replies>
<reply number="0">
<user>Larry</user>
<text>Hi!</text>
</reply>
<reply number="1">
<user>Niki</user>
<text>Morning!</text>
</reply>
<reply number="2">
<user>Joe</user>
<text>Night!</text>
</reply>
</replies>
# per leggere il file data.xml uso questo codice:
use XML::Simple;
my $simple = XML::Simple->new( );
my $tree = $simple->XMLin( './data.xml' );
print $tree->{ reply }->{ user }[0]; # stampa: Larry...giusto?
come faccio a stampare tutti i <reply>? credo cmq con un ciclo...ma non so come...
come faccio ad aggiungere alla struttura i nuovi dati e poi ad aggiornare il file:
<reply number="3">
<user>Paul</user>
<text>How are you?</text>
</reply>
lo posso fare con XML::Simple? il file lo aggiorna il modulo o devo farlo io?
e se avessi voluto modificare i valori di <reply number="2">?
Grazie...