Not necessarily the solution, but you should be using
use strict;
# and this really helps DURING development.
use CGI::Carp qw(fatalsToBrowser);
I tried setting '$ENV{'QUERY_STRING'} = "test";' before the blockquote, and it printed as expected, so not sure yet why(my own ignorance, per usual, but the only way to learn) why $ENV{'QUERY_STRING'} is not being set...
update: I took your original code, and swapped
$exit_link = "$ENV{'QUERY_STRING'}";
# for
$exit_link = "Perlmonks rocks.";
after a refresh it pulls up properly. So I gather that you cannot view the cookie contents the same time that you put it, and $ENV{'QUERY_STRING'} is empty(which makes sense now because there was no REQUEST).
update(2); Spelling...