sub msg { my $msgs = { '200' => 'OK', '400' => 'Bad Request', '403' => 'Forbidden', '404' => 'Not Found', '500' => 'Internal Sever Error', }; my $msg_num = $_[0]; my $msg_txt = "$msg_num $msgs{$msg_num}"; print "HTTP/1.0 $msg_txt\n"; }