如何清除"Use of uninitialized

如何清除"Use of uninitialized
use strict;
use warnings;

my $id;

my $cookies = $m->getCookies();
my $on_rule = ($cookies->{"rule_$id"} eq "true" or !$cookies->{"rule_$id"}) ? 0 : 1;

perl 总是产生 "Use of uninitialized value in string eq at .... 这种错,是my $on_rule = ($cookies...这一行有问题,如果我想使用这种方法 $cookies->{"rule_$id"} 取$cookies中的一个值,该怎么写这句话才不会有 "Use of uninitialized value in string eq at ...