http://www.perlmonks.org?node_id=430544

meng has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I will try to write a small program which
1) get a webpage from a url
2) check some patterns or do sth.
3) display the result to user via browser.

However, I had problems dealing with the display of feedback. So I tested this small code:
#-------------------------------- #! /usr/bin/perl -w use CGI; use LWP::Simple; print "Content-type: text/html\n\n"; $url = "http://www.yahoo.com"; my $webpage = get($url); print $webpage; print<<_HTMLEND; <HTML> <BODY> <H1> hello </H1> </BODY> </HTML> _HTMLEND #-----------------------------------------
It does work if I run it in the console using "perl test.pl", but it is not working as a cgi program, basically I cannot display anything in the browser, even it is just a "hello" here.
Anything wrong? or my idea is wrong
Can anyone help me? Thank you<

Edit by castaway - Added code tags