このスレッドは、XMLファイルにデータを入力するためのPerlスクリプトの続きです。
変更したいファイルは次のとおりです。
<?xml version="1.0" encoding="UTF-8"?>
<configuration start="earth">
<country-list>
<country name="japan">
<description></description>
<start>1900</start>
<end/>
</country>
<country name="italy">
<description></description>
<start>1950</start>
<end/>
</country>
<country name="korea">
<description></description>
<start>1800</start>
<end/>
</country>
</country-list>
</configuration>
このリストに新しい国を追加したいと思います。
前の質問では、XMLファイルにデータを入力するためのPerlスクリプト。
#Get the list of cities as a list, then push "Tokyo" to it.
push @{$doc->{countries}->{country}->{'japan-'}->{city}}, 'Tokyo';
これは新しいタグを追加するために提案されましたが、私の場合、「プッシュ」をどのように正確に使用できるかわかりません。正しいタグにマッピングできません。