# %header will be in random order my $q = CGI->new; my %header = map { lc($_) => $q->http($_) } $q->http; # %ENV is in random order print Dumper \%ENV my $h = HTTP::Headers->new(%ENV); # this returns the headers in the recommended # "Good Practice" order. print Dumper $h->header_field_names; # this doesn't work as well print $h->as_string;