#!/usr/bin/perl -w use strict; use XML::Simple; my $xs = XML::Simple->new( forcearray => [ 'item' ], keyattr => { }, rootname => 'opt', ); my $opt = $xs->XMLin(\*DATA); my $id = @{ $opt->{trans}->{item} } + 1; push @{ $opt->{trans}->{item} }, { id => $id, status => 'contacted', assignee => 'jill' }; print $xs->XMLout($opt); __DATA__