13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

husband=fred pal=barney wife=wilmapet=dino你 可 以 使 用 下 面 两 个 循 环 之 一 :while( ){next unless s/^(.*?):\S*//;$who = $1;for $field ( split ) {($key, $value) = split /=/, $field;$HoH{$who}{$key} = $value;}}while( ){next unless s/^(.*?):\S*//;$who = $1;$rec = {};$HoH{$who} = $rec;for $field ( split ) {($key, $value) = split /=/, $field;$rec->{$key} = $value;}}如 果 你 有 一 个 子 过 程 get_family 返 回 一 个 键 字 / 数 值 列 表 对 , 那 么 你 可 以 拿 下 面 三 种 方 法的 任 何 一 种 , 用 它 填 充 %HoH:for $group ("simpsons", "jetsons", "flintstones" ) {253

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!