2010-03-11から1日間の記事一覧

Perlで2階層目のハッシュを参照するときは注意が必要

use strict; use warnings; my (%hash, $msg); $msg = (exists $hash{key}) ? "exist" : "not exist"; print "$msg\n"; # not exist # 1階層目を参照 my $tmp = $hash{key}; $msg = (exists $hash{key}) ? "exist" : "not exist"; print "$msg\n"; # not exi…