in reply to reading and writing a CGI cookie in the same page
You can eliminate a conditional by writing
If @new_cookies is empty, no cookies are added. This approach gives the flexibility of adding additonal cookies without having to modify existing code.push @new_cookies, cookie_creator_sub() if <<some condition>>; ... $q->header(-cookie => [ @new_cookies ]);
|
|---|