cmd-prompt> php -f scriptname.php arg-list
I use custom command line php scripts every day. It works great. I started this *before* I installed a local web server on my machine. I have nothing bad to say about either language, and use both.
|I use custom command line php scripts every day. |
I do also
|I have nothing bad to say about either language |
mod php/mod perl is the only way to go :)
There are other ways to go.
I use REBOL for most of my CGI work. If PERL is duct tape, REBOL is a shirt-pocket powertool.
But language choices are highly personal things, so let's not slip into a war about the "best" -- the best available is what you can use the best.
I don't think PHP will get the full functionality that Perl has. The important difference seems to be that the PHP language is targetted to the www and tasks performed there (here) whereas Perl is a general scripting language and is put to use outside the www as well.
As for popularity in the web developer community, i think PHP either is or will become the most popular. It's fairly easy to learn and more "tightly" structured than Perl and it's also a very rich environment (for web development) so i guess that many web developers will never have the need to explore Perl's possibilities.
IMHO, Perl will continue to be the most powerful scripting tool although other languages might be(come) more popular.
I'm currently using php to do some cli stuff - db and ftp on a cron job mainly.
I've not had much exposure to perl - is it a better language for doing this? Are there any advantages to using perl on the command line, rather than php? What makes perl more powerful than php for this kind of work?
Thanks in advance!
I use Perl for portability in case I ever change hosts. It works on Unix/Windows/Linux servers. It works on Apache, Windows and Zeus server software. Perl is usually included with any hosting package.
PHP and ASP are languages that some hosts have decided that you need to pay extra to get the translators/compilers for, and if you have a cash strapped client....dropping back to Perl can sometimes save them a few $$$$ (particularly if they already have a host they like - it can save them from upgrading).....
I'd say Perl is more powerful overall, but for web work PHP is as good if not better IMO. There are many web specific functions built right in. Sending email - one liner. All GET and POST vars are just there, nothing to do. Need to strip HTML tags? Forget the regexp, there's a function. Etc, etc. And now the CLI as well which is a nice addition.
But one area where I think PHP is winning over Perl bigtime is documentation. As a reference nothing beats php.net/manual/en/ IMO. If I don't know how do something in PHP it never takes more than a few minutes - tops - to find out. Examples and all. Could be me, but with Perl it seems to turn into a quest.
PHP is just as portable as Perl. I don't know where you've been looking for hosts. Most in the US offer PHP for no extra charge. If you want a windows server instead, most offer ASP and PHP for no extra charge either.
Well I still rout for HTAG. Am usign it for 100s of 1000s of pages sites, fully dynamic, db driven, multi threaded, load balanced, and can do anything, down to writing functions for it in assembly...
Has quite some libs, can be written in HTAG, delphi, c or others. XML lib, email functions has it'S own file based DB engine for when mySQL is notavailable, caching DB middleware..
and so on and so on... needless to say I wrote it myself and you'Re not getting it ;)
On the minus, it's buggy and sometimes cumbersome, as I evolved the syntax, not designed it... but I can change anythign I don't like at any time ;)
So keep your pearl and php ;)
Developing perl CGI for quite a few years now, I've got my own library too of web tools I use all over the place. I've never run into anything I needed that Perl can't do.
Here's another question: which language is fastest? Is PHP faster than Perl or Mod Perl?
I'm completely new to Perl. I'm a database administrator and sometimes has to automates things from the command line. I work both in Unix and Windows environment. After reading this thread, it seems like Perl is the next likely thing for me to learn to get more versatility out off batch scripts and shell scripts.
Can anyone recommend a book or resource for someone who's never touch perl to use to get started in learning to script with perl (on the server-side)?
|Can anyone recommend a book or resource for someone who's never touch perl |
If you have a printer and ink, there's a great book that's freely available online:
by Simon Cozens
After that, most of the more advanced books on perl are from o'reilly:
there is also
I started with "Learning Perl" from O'Reilly, and I use "Programming Perl" from the same publisher whenever I need a quick reference
- Learning Perl [amazon.com] at Amazon.com
- Programming Perl [amazon.com] at Amazon.com
Hope the links work - if not, just search for them.
> I don't know where you've been looking for hosts. Most in the US offer....
There lies the problem. We are not in the US. And we don't want to host in the US. We want a UK IP address and there are are a few hosts over here that want more money for ASP or PHP support by forcing you to take a higher spec account. Don't get me wrong, but I don't want to pay for 100Mb of space when I am only using 1Mb for a small dynamic site and 20Mb is more than enough (but doesn't support PHP or ASP!). Which means that someone can be paying an extra 25% for PHP/ASP support!
I've been working with perl for years and only became comfortable with PHP about a year ago. So far, I can't decide which language I like best.
I think perl is best for pure text handling, and PHP is best for database handling.
I use both perl and PHP from the command line. Personally I think perl is easier to work with for most tasks, but PHP is growing on me :)
I was using PHP for about four years, and then switched to Perl completely. Things that made me do it are CPAN, and the Perl community (way more knowledgeble, and overal experience is just superior). Software like HTML::Mason and Class::DBI cut my development times in half, if not more. Plus, many useful features of mod_perl are unparalleled in PHP.
It's sometimes sad to see developers who are smart and experienced enought to understand Perl, still fighting with PHP for years, not knowing what they are missing.
PHP is just the VB of web development. Nothing less, nothing more.