Displaying text file in browser - perl

I am having issue dispalying text file in browser using perl.

Here is my code:

#!/usr/bin/perl

print "content-type: text/html \n\n";

open (FH , "access.log") || die "Blah $!";
while (<FH>) {
  print $_ ;
}

I have correct permissions and everything. The weired thing is when I print inside CONSOLE , it works fine but when I try to run it from broswer (with proper read/execute) permissions it just displays WHITE page (nothing in it).

Can some perl expert shed some light ... much appreciated.

Here is content of my file (its basically squid log):

1221275639.716 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275640.770 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275641.792 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275642.827 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275643.869 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275644.896 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275645.948 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275646.970 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275648.029 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275649.064 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275650.100 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275651.241 6 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275652.274 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html
1221275653.328 7 24.130.155.89 TCP_DENIED/407 409 HEAD http://cr-tools.clients.google.com/service/check2? - NONE/- text/html

Any help is highly appreciated :slight_smile:

thx.

I am closing this thread. It is a duplicate of another thread by same user in this forum.