use strict; use warnings; use CGI; my $q = new CGI; # when assigning $hash{'key'} = $q->cookie('key') || '0';