<div>正好beginners-lists上也在讨论Perl与PHP这个话题,我把它转一下。</div>
<div> </div>
<div>></div>
<div>> What are the differences between Perl and PHP?<br><br>The differences are far too many to list here. However, I'll list a<br>few:<br><br> Perl tends to run slightly faster. Your site's visitors probably<br> won't notice any lag, though.
<br><br> PHP has a more anemic syntax. For instance, variable types are not<br> really differentiated in syntax at all, which can lead to some ugly<br> hacks every now and then. On the other hand, a simpler syntax can
<br> make it easier to do some simple things.<br><br> PHP has more core functions (about ten times as many, give or take).<br> This is part of the reason it's slower than Perl, in fact. This can<br> make the language more accessible to beginners, since "programming"
<br> with PHP often involves nothing more than looking up the function you<br> need to do your job. On the other hand, while there are an ungodly<br> number of functions for doing the same tasks in very slightly<br> different ways in some cases, in others the functions needed to do
<br> some very common and simple things are strangely absent, which can be<br> frustrating.<br><br> The ability to embed PHP directly in code and have the server parse it<br> is more commonly available on cheap webhosts than the ability to do
<br> the same with Perl, though SSI does make up some of the difference.<br> Since SSI is even more anemic than PHP, and doesn't really have "core<br> functions", this can lead to some juggling to handle insertion of Perl
<br> output into the page that isn't necessary with PHP -- but if you need<br> more than SSI to do it, you probably need to do it in the Perl scripts<br> anyway for the sake of good programming practice.<br><br> PHP tends to suffer more security issues than Perl. I'm pretty sure
<br> the function-heavy design of the language contributes to that, but I<br> don't know for sure. Good, security-conscious programming techniques<br> should allow you to work around such security issues without too much
<br> trouble, however, so unless you know of specific issues that are not<br> acceptable to you, this probably shouldn't make your decision for you.<br><br> There are more beginner-level quick-start scripts out there in PHP
<br> that are easily modified in trivial ways than there are in Perl, from<br> what I've seen.<br><br> PHP has the potential to teach you a lot of bad habits as a programmer<br> if it's the first language you learn -- but it also has the potential
<br> to be a very easy introduction to programming, perhaps easier than<br> Perl if you're going to use either only for web programming to begin<br> with.<br><br> Perl has some of the most informative programming communities filled
<br> with some of the most knowledgeable programmers you're likely to find<br> on the Internet. I speak of people on this list such as Tom Phoenix<br> and Randal Schwartz, and of a pretty big percentage of the population
<br> at <a href="http://perlmonks.org">perlmonks.org</a> (I'm constantly surprised by the density of<br> programming wisdom there).<br><br> Maybe I'm looking in the wrong places, but I just haven't seen as much<br> quality of PHP books as Perl books.
<br><br> Perl is far more fun. Okay, so I'm biased.<br><br> Perl regular expressions are much much MUCH better than PHP regular<br> expressions. Seriously, working with PHP regular expressions is a bit<br> like trying to sort M&Ms with staples in my fingertips. It's not fun.
<br><br> Despite my bias, I end up using PHP more for web development than PHP.<br> This is in large part because for the very simplest tasks, it's just<br> easier. I could probably just use SSI and no PHP to do the very
<br> simple stuff that leads me to use PHP more often than Perl, but<br> somehow SSI never occurs to me except when working with Perl.<br><br> Perl is useful for a lot more than PHP, generally. If you want to<br> learn a language that will prove useful outside of web development,
<br> you're probably better of with Perl. On the other hand, learning both<br> eventually might be a good idea too.<br><br>Is this list too long yet? I could go on forever.<br><br><br>><br>> Which one is the best to build up a website?
<br><br>That depends on what you're going to do with the website. Some website<br>development is more easily accomplished in PHP, some in Perl. Sometimes<br>factors other than ease of development come into play, too. There's no
<br>simple answer to that question as you asked it. 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. Perhaps you should start there, if you don't
<br>already know these things. 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. I occasionally refer to it myself, though I know XHTML
<br>and CSS better than almost anyone I know.<br><br><br>><br>> There are more and more PHP-based websites. Except the fact that ISP <br>> provide most of the time PHP/MySQL web hosting, why do people prefer <br>
> 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. 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. Don't let that stop you,<br>though. We all have to start somewhere.<br><br><br>> <br>> I would like to create one only using Perl. Consequently, what are the
<br>> most used modules for this purpose?<br><br>Woah, nellie. There's no way to give a meaningful answer to this,<br>really. 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. 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. 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. 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. 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. 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. Learning Perl taught me good habits<br>that I've been able to apply to PHP. 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. It'll make<br>you a better PHP programmer. 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. Someone else is sure to have a take that<br>completely disagrees.<br> </div>
<div><br><br> </div>
<div><span class="gmail_quote">在06-5-27,<b class="gmail_sendername">黄叶</b> <<a href="mailto:hylinux@gmail.com">hylinux@gmail.com</a>> 写道:</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> </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>