作者split (刚者必折 骄必败)
看板perl
标题[问题] exist
时间Sat Apr 14 01:43:31 2007
请问一个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
1F:推 cot123:第一行我想你应该是要打#!/usr/bin/perl吧 04/14 07:42
2F:→ cot123:另外我想你要的是exists 04/14 07:43
3F:→ gohiei:我认为是 defined $hash_ref... 04/14 23:20
4F:推 billmax:问一下问题,为什麽my $hash_ref 跟my %hash_ref 都可以? 04/17 22:54