<div>正好beginners-lists上也在讨论Perl与PHP这个话题,我把它转一下。</div>
<div>&nbsp;</div>
<div>&gt;</div>
<div>&gt; What are the differences between Perl and PHP?<br><br>The differences are far too many to list here.&nbsp; However, I'll list a<br>few:<br><br>&nbsp; Perl tends to run slightly faster.&nbsp; Your site's visitors probably<br>&nbsp; won't notice any lag, though.
<br><br>&nbsp; PHP has a more anemic syntax.&nbsp; For instance, variable types are not<br>&nbsp; really differentiated in syntax at all, which can lead to some ugly<br>&nbsp; hacks every now and then.&nbsp; On the other hand, a simpler syntax can
<br>&nbsp; make it easier to do some simple things.<br><br>&nbsp; PHP has more core functions (about ten times as many, give or take).<br>&nbsp; This is part of the reason it's slower than Perl, in fact.&nbsp; This can<br>&nbsp; make the language more accessible to beginners, since &quot;programming&quot;
<br>&nbsp; with PHP often involves nothing more than looking up the function you<br>&nbsp; need to do your job.&nbsp; On the other hand, while there are an ungodly<br>&nbsp; number of functions for doing the same tasks in very slightly<br>&nbsp; different ways in some cases, in others the functions needed to do
<br>&nbsp; some very common and simple things are strangely absent, which can be<br>&nbsp; frustrating.<br><br>&nbsp; The ability to embed PHP directly in code and have the server parse it<br>&nbsp; is more commonly available on cheap webhosts than the ability to do
<br>&nbsp; the same with Perl, though SSI does make up some of the difference.<br>&nbsp; Since SSI is even more anemic than PHP, and doesn't really have &quot;core<br>&nbsp; functions&quot;, this can lead to some juggling to handle insertion of Perl
<br>&nbsp; output into the page that isn't necessary with PHP -- but if you need<br>&nbsp; more than SSI to do it, you probably need to do it in the Perl scripts<br>&nbsp; anyway for the sake of good programming practice.<br><br>&nbsp; PHP tends to suffer more security issues than Perl.&nbsp; I'm pretty sure
<br>&nbsp; the function-heavy design of the language contributes to that, but I<br>&nbsp; don't know for sure.&nbsp; Good, security-conscious programming techniques<br>&nbsp; should allow you to work around such security issues without too much
<br>&nbsp; trouble, however, so unless you know of specific issues that are not<br>&nbsp; acceptable to you, this probably shouldn't make your decision for you.<br><br>&nbsp; There are more beginner-level quick-start scripts out there in PHP
<br>&nbsp; that are easily modified in trivial ways than there are in Perl, from<br>&nbsp; what I've seen.<br><br>&nbsp; PHP has the potential to teach you a lot of bad habits as a programmer<br>&nbsp; if it's the first language you learn -- but it also has the potential
<br>&nbsp; to be a very easy introduction to programming, perhaps easier than<br>&nbsp; Perl if you're going to use either only for web programming to begin<br>&nbsp; with.<br><br>&nbsp; Perl has some of the most informative programming communities filled
<br>&nbsp; with some of the most knowledgeable programmers you're likely to find<br>&nbsp; on the Internet.&nbsp; I speak of people on this list such as Tom Phoenix<br>&nbsp; and Randal Schwartz, and of a pretty big percentage of the population
<br>&nbsp; at <a href="http://perlmonks.org">perlmonks.org</a> (I'm constantly surprised by the density of<br>&nbsp; programming wisdom there).<br><br>&nbsp; Maybe I'm looking in the wrong places, but I just haven't seen as much<br>&nbsp; quality of PHP books as Perl books.
<br><br>&nbsp; Perl is far more fun.&nbsp; Okay, so I'm biased.<br><br>&nbsp; Perl regular expressions are much much MUCH better than PHP regular<br>&nbsp; expressions.&nbsp; Seriously, working with PHP regular expressions is a bit<br>&nbsp; like trying to sort M&amp;Ms with staples in my fingertips.&nbsp; It's not fun.
<br><br>&nbsp; Despite my bias, I end up using PHP more for web development than PHP.<br>&nbsp; This is in large part because for the very simplest tasks, it's just<br>&nbsp; easier.&nbsp; I could probably just use SSI and no PHP to do the very
<br>&nbsp; simple stuff that leads me to use PHP more often than Perl, but<br>&nbsp; somehow SSI never occurs to me except when working with Perl.<br><br>&nbsp; Perl is useful for a lot more than PHP, generally.&nbsp; If you want to<br>&nbsp; learn a language that will prove useful outside of web development,
<br>&nbsp; you're probably better of with Perl.&nbsp; On the other hand, learning both<br>&nbsp; eventually might be a good idea too.<br><br>Is this list too long yet?&nbsp; I could go on forever.<br><br><br>&gt;<br>&gt; Which one is the best to build up a website?
<br><br>That depends on what you're going to do with the website.&nbsp; Some website<br>development is more easily accomplished in PHP, some in Perl.&nbsp; Sometimes<br>factors other than ease of development come into play, too.&nbsp; There's no
<br>simple answer to that question as you asked it.&nbsp; Regardless of which you<br>decide to use, though, you're going to need to know some XHTML, and<br>should know some CSS too.&nbsp; Perhaps you should start there, if you don't
<br>already know these things.&nbsp; There's a reasonably good reference website<br>on those topics and more at <a href="http://www.w3schools.com/" target="_blank">http://www.w3schools.com</a> that you can use to<br>get up to speed.&nbsp; I occasionally refer to it myself, though I know XHTML
<br>and CSS better than almost anyone I know.<br><br><br>&gt;<br>&gt; There are more and more PHP-based websites. Except the fact that ISP <br>&gt; provide most of the time PHP/MySQL web hosting, why do people prefer <br>
&gt; using PHP instead of Perl?<br><br>It's really really easy to get started writing code in PHP and deploying<br>it on a web server.&nbsp; Of course, this is also probably why there's more<br>really awful PHP in use on simple websites than really awful Perl: the
<br>barrier to entry is lower, which means greater accessibility to people<br>who don't really know what they're doing.&nbsp; Don't let that stop you,<br>though.&nbsp; We all have to start somewhere.<br><br><br>&gt; <br>&gt; I would like to create one only using Perl. Consequently, what are the 
<br>&gt; most used modules for this purpose?<br><br>Woah, nellie.&nbsp; There's no way to give a meaningful answer to this,<br>really.&nbsp; I guess you might say CGI is the most-used module for web<br>programming, and that may even be accurate, but it probably won't help
<br>you much unless it just happens to be the right answer for you by some<br>kind of coincidence.&nbsp; It's typically better to come up with a site<br>architecture and a plan for how you're going to implement it, then start<br>
looking for modules to fulfill your needs, rather than to get a list of<br>commonly used modules and look for ways to develop your site using them.<br><br>As much as it pains me to say it, I think you might be best served to
<br>start out with PHP, and come back to Perl when you have a bit more of a<br>grasp of what you're doing with web programming.&nbsp; I've personally found<br>that it seems to work better to start learning Perl for reasons other
<br>than web programming and to come back to web programming once some more<br>general understanding of Perl is gleaned.&nbsp; I ended up learning PHP<br>mostly to cover the web programming side of things while using Perl for<br>
simple system administration tasks and so on, until I got to a point<br>where I knew Perl well enough to be able to apply it intelligently to<br>web development.&nbsp; Some of this, I'm sure, has to do with the fact that<br>the really good resources for Perl tend to be focused on tasks more
<br>related to systems administration and glue code, while web development<br>resources for Perl are often written by people trying to make a fast<br>buck who aren't necessarily experts.&nbsp; PHP resources aren't any better,<br>
but as I pointed out before it's easier to get started with PHP for web<br>development if you're coming to it from knowing nothing at all.<br><br>Of course, if I wasn't simultaneously learning Perl while learning PHP<br>for web development, I'm pretty sure my PHP skills would have
<br>consistently sucked all along, too.&nbsp; Learning Perl taught me good habits<br>that I've been able to apply to PHP.&nbsp; When learning PHP, I recommend you<br>also learn another language pretty much at the same time, for some other
<br>purpose than web programming -- a language with a rich syntax and a very<br>good community with very good free resources like PerlMonks.&nbsp; It'll make<br>you a better PHP programmer.&nbsp; Perl is particularly suited to this, since
<br>before PHP was its own programming language, it was just a toolkit for<br>web development built using Perl.<br><br>That's my take on it.&nbsp; Someone else is sure to have a take that<br>completely disagrees.<br>&nbsp;</div>
<div><br><br>&nbsp;</div>
<div><span class="gmail_quote">在06-5-27,<b class="gmail_sendername">黄叶</b> &lt;<a href="mailto:hylinux@gmail.com">hylinux@gmail.com</a>&gt; 写道:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>呵呵。<br>什么未必呢?<br><br>只是说可能嘛。<br>既然是有可能就是未必了。<br><br>但是不清楚你说未必指的是什么哦。<br>呵呵<br><br>不过认真学习和使用Perl,好像不是未必哦。<br><br>*^-^*<br>&nbsp;</div><br>_______________________________________________<br>China-pm mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:China-pm@pm.org">
China-pm@pm.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://mail.pm.org/mailman/listinfo/china-pm" target="_blank">http://mail.pm.org/mailman/listinfo/china-pm</a><br></blockquote></div><br>