
#!/usr/bin/perl -w |
use strict; |
use XML::Simple; |
my $text = <<xml; |
< ?xml version="1.0"? > |
<web-app> |
<servlet> |
<servlet-name>php</servlet-name> |
<servlet-class>net.php.servlet</servlet-class> |
</servlet> |
<servlet-mapping> |
<servlet-name>php</servlet-name> |
<url-pattern>*.php</url-pattern> |
</servlet-mapping> |
</web-app> |
xml |
my $x = XMLin($text); |
foreach my $tag(keys %$x) |
{ |
my %h = %{$$x{$tag}}; |
foreach(keys %h) |
{ |
print "$tag => "; |
print "$_ => $h{$_}\n"; |
} |
} |
exit 0; |




by: 发表于:2017-09-13 14:15:36 顶(0) | 踩(0) 回复
??
回复评论