header problem

Without the header content-type my CGI program works!. None of the other headers (Pragma , expire) work. Please suggest a solution.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Check your web server configuration?!
Hang on, a cgi with a content-type header? Do you mean the scripts first few lines have the text 'Content-type...' or do you mean the script outputs (ie prints) the text 'Content-type'? Apologies if this seems a silly question, but one never knows...

Assuming the latter, could you show us the few lines around the part of your script that outputs the text 'Content-type'.

??? how does that work? ???
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

jas_janAuthor Commented:
use AnyDBM_File;
use CGI;

$no = 1;
foreach $val(@form)
      $name =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
      $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack("C",hex($1))/eg;
      $fac{$no} = $value;

$query = new CGI;
print "<html>";
print "<body bgcolor=biege>";
print "<center><img src=logo.gif></center>";
print "<br><h2><center><font color=red>PERL Test</font></center></h2><br><br>";

sub admin{
      print "<br><h3><center>For Administrator</h3><br><br>";
      print $query->startform("POST","show.pl");
      print "<b>Duration&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</b> ";
      print $query->textfield('time');
      print "<br><br><b>No.of Questions  :</b> ";
      print $query->textfield('noq');
      print $query->hidden('fname' , $fac{1});
      print "<br><br>",$query->submit('form1','Submit'),"</center>";
      print $query->endform;
      print $query->end_html;
This is my CGI program. If I attach any header it prints it as it is. Without the headers it works. But I need pragma/Expire header desperately. Pl give me solution.
How do you attach any header?
Someting like this?
 print $query->header(-expires=>'+3d');
 print $query->start_html(-meta=>{'Pragma' =>'no-cache'});

jas_janAuthor Commented:
I attached header as follows.

print "Content-Type: text/html\r\n";
print "Expires: Sat, 30 Mar 1998 10:29:02 GMT\r\n\r\n";

Pl give me solution. It is very urgent.
jas_janAuthor Commented:
I didn't use CGI module at all. Headers didn't work even in a very simple program.
I don't follow this...You gott to be more specific.
jas_janAuthor Commented:
If I attach header as
print "Content-Type: text/html\r\n";
print "Expires: Sat, 30 Nov 1996 10:29:02 GMT\r\n\r\n";
it prints the two lines as it is. I'm desperate to use either pragma or expire header. My page has to expire immediately. Even in a very simple program the two lines are displayed in the browser. It is very urgent. Pl give me solution.
the syntax here is wrong. You have to use:

print "Content-type: text/html\n\n";
(don't capitalize '-type')

and then after the head tag, use

print "<meta http-equiv=\"expires\" content=\"0\">\n\n";

this should work. Also, don't rely on the output of your browser because it may be cached. Either use lnyx or a text viewer to view the output, and your brain to translate it ;-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jas_janAuthor Commented:
Sorry. I've given the correct syntax only in my program.I've referred so many books regarding this and I've used all the methods. But still it is is not working.  

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.