I have reasonable knowledge of PHP, Perl, and Bash. I use Perl for most text pro
ID: 649984 • Letter: I
Question
I have reasonable knowledge of PHP, Perl, and Bash. I use Perl for most text processing on my system (find, replace, filter output, etc). I use PHP for web development, allowing a user to view and interact with database data via the browser. I use Bash for quick and dirty scripts often to supplement the more complex Perl scripts.
I'm a big believer of focusing on as few languages as possible (to get the job done) and becoming an expert in them.
So the question is, why not use PHP for the common tasks that Perl (and Bash) are used? Are there good reasons (limitations or features) why PHP is mostly used for web development, while Perl and Bash are mostly used for "offline" "scripting"?
Explanation / Answer
Because Perl has a much more powerful feature set than PHP.
Perl is a more general programming language, and has much more text operations capabilities than PHP, and probably than any other language out there, and better OS interaction.
Perl has a powerful Regex native support, which means string manipulations at its best.
Also, Perl has been around for many years now, and offers a huge library of modules. Create complex scripts with Perl is easy; with the right modules you only need to write little lines of code.
You may want to take a look at this great answer which explains clearly the differences between the two languages.