13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3: 0.799749050426126 0.3001849639607924: 0.599474551447884 0.2139352860299165: 0.700232143543861 0.8007737512966716: 0.201203608274334 0.06543032906395757: 0.605381294683365 0.7181623040904878: 0.452976481105495 0.5740262691216679: 0.736819876983848 0.39173761066204410: 0.518606540417331 0.381805078272308不 过 事 还 没 完 ! 它 向 你 的 屏 幕 输 出 是 因 为 上 面 的 *SCATTER tie 里 的 -。 而 且 那 一 行 还 命令 它 创 建 文 件 tmp1,tmp2, 和 tmp4, 同 时 还 附 加 到 文 件 tmp3 上 。( 我 们 在 循 环 里 还向 *NULL 输 出 了 , 当 然 那 不 会 在 任 何 有 趣 的 地 方 显 示 任 何 东 西 , 除 非 你 对 黑 洞 感 兴 趣 。)14.5 一 个 精 细 的 松 绑 陷 阱如 果 你 试 图 使 用 从 tie 或 者 tied 返 回 的 对 象 , 而 且 该 类 定 义 了 一 个 析 构 器 , 那 么 你 就 得小 心 一 个 精 细 的 陷 阱 。 看 看 下 面 这 个 ( 故 意 设 计 的 ) 例 子 类 , 它 使 用 一 个 文 件 来 记 录 赋 予 一个 标 量 的 所 有 值 :package Remember;sub TIESCALAR {my $class = shift;my $filename = shift;open (my $handle, ">", $filename)or die "Cannot open $filename: $!\n";print $handle "The Start\n";bless {FH => $handle, VALUE => 0}, $class;}395

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

Saved successfully!

Ooh no, something went wrong!