编程学习biancheng.45soft.com 本站提供了各种在线教程和资料,供大家学习与参考.
编程学习
当前位置: 主页 > Perl > 数组和散列 > Perl 数组和散列 甚至更灵活的记录的组合和访问和打印

Perl 数组和散列 甚至更灵活的记录的组合和访问和打印

自然,你的数据结构的域本身也可以是任意复杂的数据结构:

%TV = (
flintstones => {
     series   => "flintstones",
     nights   => [ "monday", "thursday", "friday" ],
     members  => [
     { name => "fred",    role => "husband", age  => 36, },
     { name => "wilma",   role => "wife",    age  => 31, },
     { name => "pebbles", role => "kid",     age  =>  4, },
     ],
},


jetsons     => {
     series   => "jetsons",
     nights   => [ "wednesday", "saturday" ],
     members  => [
     { name => "george",  role => "husband", age  => 41, },
     { name => "jane",    role => "wife",    age  => 39, },
     { name => "elroy",   role => "kid",     age  =>  9, },
     ],
},

simpsons    => {
     series   => "simpsons",
     nights   => [ "monday" ],
     members  => [
     { name => "homer", role => "husband", age => 34, },
     { name => "marge", role => "wife",    age => 37, },
     { name => "bart",  role => "kid",     age => 11, },
     ],
},
);



编程学习 Perl 数组和散列 甚至更灵活的记录的组合和访问和打印 转载请保留此行.谢谢.

Perl