- 论坛徽章:
- 0
|
回复 3楼 coolend 的帖子
Hi,
using Data::Dumper to study (or research :-)) the data structure.
read more about => perldoc perllol, perldoc perldsc
For example to manuplate the complex data structure:
- use strict;
- use XML::Simple;
- use Data::Dumper;
- my $config = eval { XMLin('book.xml') };
- print Dumper($config), "\n";
- my $bk = $config->{'book'};
- # how many books:
- print "total books: ", scalar keys %$bk, "\n";
- # get book name only;
- print "$_\n" foreach sort keys %$bk;
- # get first book's record only, but the bookname is unknown.
- my $bk_1 = (sort keys %$bk) [0];
- print "book 1: $bk_1\n";
- print "cn : " . $bk->{$bk_1}->{cn} . "\n";
- print "date : " . $bk->{$bk_1}->{date} . "\n";
复制代码
regards, ulmer |
|