October 1st, 2000, 11:41 PM
I've recently been really into writing Perl scripts. However, the scripts I've been writing also utilize MySQL, the only DB software my server has available. This sucks, cause Perl sucks w/MySQL compared to PHP. Mostly due to the fact it can't count the rows returned from the query.
Now, I really dont want to drop everything I've learned in Perl and switch to PHP. What kind of stuff is Perl really good for just to give me more reason to stay with Perl. Like what scripts are very good w/perl.
THanks for anyinput I get.
October 2nd, 2000, 02:07 AM
I think PERL is more fun when you have to parse through lots of text, because it has way more functionality with regular expressions. I've never used it for such, but it can apparently do more system operations from a command line than PHP. However, PERL is very extensible language, but it was not originally written for the web and PHP was. Here's another bit of trivia, in its original incarnation, PHP was just a bunch of PERL scripts, so if'n you know PERL, PHP is super easy.
[This message has been edited by billyo (edited October 02, 2000).]
October 2nd, 2000, 03:33 AM
Bah, you're just too used to letting the script to all the work for you (through functions). You can do it yourself by just looping through the list and incrementing a variable (such as $i) each time. Or you can do exactly what the php function would do... use the SQL command:
"SELECT COUNT(*) FROM ..." SQL statement with the same "..." as your query and then fetch the row count from that.
That way you can get the number of rows in one simple sql command. Trust me... anything that php can do, perl can do... and many able to do it better/faster.
[This message has been edited by JonLed (edited October 02, 2000).]
October 2nd, 2000, 03:34 AM
There actually is a $count=$dbh->row; function that you can use, but they docs say it's not dependable and varies from system to sysem (sometimes it returns -1 until all the rows are fetched)
October 2nd, 2000, 08:00 AM
Each language has their pro's and con's
Some things PHP is great for buy Perl is very powerfull but each user is different and has different needs.
PHP is easier if you know perl but if you know enough perl to look at a cgi script and know sort of whats going on thats a good start
PHP/MySQL Enabled Hosting/Dedicated Servers