in reply to read an integer from a file
Try changing the print $a to print STDERR $a and looking in the log file.
As it's written it looks like $a is going to be the first thing sent back to the browser, making further headers useless.
Update
And use IO::All, it's just so cool.
open (MYFILE, "status2.txt"); $a=<MYFILE>; print "$a"; # can be written as use IO::All; $a < io("status2.txt"); print "$a";
In Section
Seekers of Perl Wisdom