my $a_type = "alpha";
my $type=$a_type;
if($type eq "alpha"){
$file='beta.xml';
}
my $twig= XML::Twig->new(
pretty_print => 'indented',
twig_roots => {
name => sub{
my ($p, $name) = @_;
$name->set_text( "sai" );
$name->print;
$name->purge;
return;
},
}
twig_print_outside_roots => 1,
);
$twig->parsefile_inplace( $file, 'bak.*' );
$twig->flush;
####
Ram
10
####
Sai
10
####
Sai
10