Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: PHP to PERL ?

by ph713 (Pilgrim)
on Dec 28, 2005 at 02:54 UTC ( [id://519478]=note: print w/replies, xml ) Need Help??


in reply to PHP to PERL ?

The only real hurdle in switching from php to perl is to wrap your head around the inversion of quoting. php says:
<html> <body>This is a <?php echo $file_type ?> file </body> </html>
perl says:
#!/usr/bin/perl -wT print qq{<html><body>This is a }; print $file_type; print qq{ file</body></html>};
Which is of course uglier. php is code embedded in html - in perl it has to be html embedded in code. The answer is, as mentioned, to use templating to turn things back around to a more php-ish perspective. But get used to the idea that the template is *not* your code. It is just a template, which may contain some dynamic variables and perhaps even simple decisions and output switching. But any reasonably complex code that doesn't deal directly with the HTML formatting of the output belongs in the real script which then loads and processes the template.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://519478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found