In any case, I managed to come up with a workaround where I didn’t have to get involved with converting a function from perl to php. It was starting to get really complicated really quickly…
Well Perl is not PHP
PHP was created specially to do web development, Perl wasn’t.
So when you do a print or an echo in PHP de parser adds some important lines so the webbrowser knows what to do with them.
Perl doesn’t, there you need to add them yourself.
the extra print line sends the correct Content-type to the webbroswer so he can display all the following print statements correctly.
That’s not very handy… I hear you thinnking.
Wel The perl community wouldn’t be the perl community if they can’t make it easier you got to love CPAN and the members
If you really want to get into using Perl to develop for the web, you should take a look at the CGI module from CPAN. This will make your life easier. It will automaticly include all special processing which otherwise you need to do by hand:
Instead of CGI, check out mod_perl(2) if you’re running Apache… CGI will give you the impression that Perl is too slow for web development : ) Current CGI scripts should work fine with mod_perl.
*edit I noticed Matt’s Script Archive appears in google if you look for “cgi perl”. Avoid that at all costs: it’s outdated enough to destroy worlds! Try to stick with good perl sources like perldoc, CPAN, perlmonks, perl.com, etc.