#!C:\xampp\perl\bin\perl.exe use utf8; use Text::Unidecode; use Web::Query; use DBI; print "content-type: text/html \n\n"; wq('http://example.com') ->find('h1') ->each(sub { my $i = shift; $i++; push(@array, $_->text . "\n"); return @array; }); foreach ( @array ) { print $_ . "\n"; } #### Server error! The server encountered an internal error and was unable to complete your request. Error message: End of script output before headers: test.pl If you think this is a server error, please contact the webmaster. Error 500 localhost Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3