sub load_cookies{ local (*cook_arr) = @_; foreach (split(/\;\s*/,$ENV{'HTTP_COOKIE'})){ my ($cur_key, $cur_val) = split(/\=/); $cook_arr{"$cur_key"} = $cur_val; } } load_cookies(*cooks); print $cooks{"cook_name"};