[問題] 對hash of hash 用exist
請問一個hash of hash個問題,
我想要用exist測試看看{'c'}存不存在,
但是perl卻會出現
Can't call method "exist" on unblessed reference at test.pl line 5
的錯誤訊息,請問有人知道要怎麼修改嗎?
perl script file如下:
#!/bin/usr/perl
my $hash_ref;
$hash_ref->{'a'}->{'b'}="super";
if (exist $hash_ref->{'a'}->{'c'}){
print $hash_ref->{'a'}->{'c'}."\n";
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.42.2
推
04/14 07:42, , 1F
04/14 07:42, 1F
→
04/14 07:43, , 2F
04/14 07:43, 2F
→
04/14 23:20, , 3F
04/14 23:20, 3F
推
04/17 22:54, , 4F
04/17 22:54, 4F