#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Piscataway, NJ, USA
    Posts
    10
    Rep Power
    0
    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    114
    Rep Power
    15
    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).]
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    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).]
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    16
    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)
  8. #5
  9. No Profile Picture
    Carpe Diem
    Guest
    Devshed Newbie (0 - 499 posts)
    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



    ------------------

    Regards
    Darren
    --
    http://www.php4hosting.com/ $
    http://www.php4hosting.co.uk/
    PHP/MySQL Enabled Hosting/Dedicated Servers

IMN logo majestic logo threadwatch logo seochat tools logo