if (exists $cookies{ID}) { my $id = $cookies{ID}->value(); # do something here }