Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'll point out that moving from Perl to PHP is *very* easy.

Is it really? Perhaps you are right for simple web based stuff like a mail form, a simple database driven site or just templating. However, real programming isn't translated to PHP so easily.

First of all, what are you going to do with namespaces? PHP still does not have namespaces.

Then, what will you do with closures? PHP has no closures. Heck, it doesn't even have anonymous functions. That's another thing: how will you be rewriting that hash of coderefs? A hash of strings that are evaled at runtime?

And what about all those objects that aren't simple hashes?

But let's assume you didn't use any of these slightly more advanced programming techniques than the average PHP "programmer" can handle. But you did use modules. You do use modules, don't you?

PHP is a web programming language, so it must have a good HTML parser ready, right? One is available, but it cannot be called good. It cannot even parse processing instructions like, ehm, <?php ...?> itself.

Another common task in web programming is sending HTML mail with a few inline images. So what alternative for MIME::Lite do you have? The PHP-ish solution is to build the message manually. Good luck, and have fun.

But at least it can open files over HTTP. Yes, that it can. But what do you do if you want more than that? What if you want to provide POST content, headers, or implement ETags? Then, you must use Curl, which isn't nearly as convenient as LWP. Don't even think about having something like WWW::Mechanize in PHP.

Enough with the modules. I think I've proven my point that CPAN makes Perl strong. Now let's discuss the core. In fact, let's focus on something extremely elementary in programming: arrays!

PHP's "arrays" are hashes. It does not have arrays in the sense that most languages have them. You can't just translate $foo[4] = 4; $foo[2] = 2; foreach $element (@foo) { print $element } to $foo[4] = 4; $foo[2] = 2; foreach ($foo as $element) { print $element }. The Perl version prints 24, PHP insists on 42. Yes, there is ksort(), but that isn't something you can guess. It requires very in-depth knowledge of PHP. And that's the one thing PHP's documentation tries to avoid :)

Also, don't think $foo = bar() || $baz does the same in PHP. In PHP, you end up with true or false. So you must write it in two separate expressions.

Exactly what makes you think and even say moving from Perl to PHP is easy? It's very, very hard to un-learn concise programming and go back to medieval programming times. And converting existing code is even harder.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re^2: Is Perl a good career move? by Juerd
in thread Is Perl a good career move? by Mutant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2022-05-16 18:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (63 votes). Check out past polls.

    Notices?