SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 26
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2007
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The difference between Perl and Python?

    Could explain me the difference between Perl and Python?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,039
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Sure I can, but first you explain to me the difference between a flower and an airplane

    My point is, they are two different scripting languages and cannot be directly compared. If you want to know the difference, read some material on both languages and see for yourself
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perl is complex old language.

    Python is new OO language designed to take the best from all languages.

    I terms of cars:
    Perl is old dirty Range Rover without one wheel when Python is new concept with anti-gravitation drive from exhibition.

  4. #4
    Non-Member
    Join Date
    May 2008
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for sharing information. I am so thankful.

  5. #5
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by max7 View Post
    Perl is complex old language.

    Python is new OO language designed to take the best from all languages.

    I terms of cars:
    Perl is old dirty Range Rover without one wheel when Python is new concept with anti-gravitation drive from exhibition.
    Why do people say such ridiculous crap like that? I agree phthon is a great language, but perl is not a creaky old language chugging along on three wheels.

    Phython is not all that new. Its only 4 years younger than perl, which appeared circa 1987, with python appearing circa 1991.

    Perl and python have a lot in common. Automatic memory managment and dynamic data types make them very similar to write code for and think of in the same way. Both have a large library of modules.

  6. #6
    SitePoint Enthusiast Beginner09's Avatar
    Join Date
    Jul 2008
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by KevinR View Post
    Why do people say such ridiculous crap like that? I agree phthon is a great language, but perl is not a creaky old language chugging along on three wheels.

    Phython is not all that new. Its only 4 years younger than perl, which appeared circa 1987, with python appearing circa 1991.

    Perl and python have a lot in common. Automatic memory managment and dynamic data types make them very similar to write code for and think of in the same way. Both have a large library of modules.
    Thanks for sharing this info! Very useful! I start leaning this scripts.

  7. #7
    SitePoint Enthusiast Tim Greer's Avatar
    Join Date
    Aug 2001
    Location
    California, home of the bear...
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The differences are they are two different languages, and nothing more. Just like the differences between PHP and Python, Ruby and Python, C and Python and so on. There are always people that like one language or hear something about a language and believe what they hear, and use those feelings to act like one is better than the other. None of it is true. All of these languages are excellent. In fact, Perl is more mature than most and offers better reliability and security than most (comparing it to things like PHP, for example, and that's not to say PHP is bad).

    Perl also offers OO if you want to use it, it's just not forced on you by design. Some people think that makes Perl a worse choice compared to Python. Again, that is not the case. That's like saying C is not good because C++ exists and is OO. It doesn't at all take anything away from C and it's a standard and is excellent. Perl is very powerful and very flexible. If you understand the language well enough, you can have scripts be stable, secure and work bug free for many, many years. There are absolutely no drawbacks to Perl. The same is true of Python, if you know it well, then you'll be set.

    Perl has been widely used for decades and remains well used and powerful. It's always growing, just like Python, PHP and Ruby. You can't lose knowing any of them. Look into them and see what one's you like best and excel it in, or just learn both. It truly gets tiring seeing people bash languages that they don't understand at all, when they are excellent choices.
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    http://www.burlyhost.com/ Shared Hosting, Reseller Hosting, more!
    Industry's most experienced staff! -- Web Hosting With Muscle!

  8. #8
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All of these languages are excellent.
    It can't be! If they are different then something must better and something is not so excellent.
    If we have Hundai, Toyota and Jaguar. Can we say all these cars are excellent?

    Programming language must be simple to read and easy to learn and write.
    Perl and C are examples of most complex languages among popular languages.

    I do not think it worth to invest in Perl coding if you are able to use different language.

  9. #9
    SitePoint Enthusiast Tim Greer's Avatar
    Join Date
    Aug 2001
    Location
    California, home of the bear...
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To assume that some languages must be poor languages because of the "choice" is more than a little short sighted. This is like saying that one car is a better one than another because of the color options. Just because you like one car better than another because of the color, doesn't mean it's a better car, especially for someone else that doesn't care about the color, but the use.

    Clearly, some languages are better suited for certain tasks, but they can all perform mostly the tasks, and many just as well as the other, provided you compare one proficient programmer in one language to another in another language.

    I'm sorry, but you're just showing ignorance about programming if you claim that they "mist be simple to read and easy to learn". The famous "C Programming Language" book by Kernighan and Ritchie is ~190 pages, without the attached reference manual, which only brings it to a total of 258 pages. It's short, easy to understand and one of the most powerful and most used languages in the world for the last 30 years,

    The Perl language is painfully easy to use and understand. Perl, like C, and like PHP, Ruby, Python, C++, and any other language, can certainly get involved and complex, but only if you make it complex. Nothing in any language is difficult to grasp. If you don't have the mind for it, and thus think it's too complex, then you don't understand it, and you not understanding it doesn't make it a poor choice for someone else.

    In fact, for web applications and data processing, especially working with text (which 99% of the web related files are made of), it's a superior choice. Again, simply because you don't agree it's easy or readable or non complex, doesn't make it so. I should know, I've been coding in all of these languages for years, and I'd certainly know if one was that much more complex over another.

    I don't recommend anyone listen to this guy. It's ludicrous to claim that Perl should be avoided. Notice I'm not bashing any language, because they are all worth learning, and Perl is certainly common and powerful enough to justify. Just knowing only Perl would provide you with the tools to do anything anyone could throw at you that can be done in any other interpreted language. It's sad to see people making claims about programming languages, arguing and flaming about it, when they have no basis for doing so.
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    http://www.burlyhost.com/ Shared Hosting, Reseller Hosting, more!
    Industry's most experienced staff! -- Web Hosting With Muscle!

  10. #10
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't agree that web apps is all about text processing.

    Does Perl is exactly easy to read and understand as Java or Python or even PHP?

  11. #11
    SitePoint Enthusiast Tim Greer's Avatar
    Join Date
    Aug 2001
    Location
    California, home of the bear...
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it's obvious that how "easy" a language is to read, depends on the person and what languages they know. You don't know Perl, you claim to know Java and Python, so of course it's going to look unfamiliar to you. If you had someone that just coded in PHP or Perl look at Python or Ruby code, there would be a lot of things they didn't understand either. How can you actually argue that Perl is a poor language because *you* don't know it? If you knew it, you'd therefore be able to understand it and it would be easy to read and use. If it WASN'T easy to read and use, then that shows that you don't know it. You can't have it both ways.

    That's like saying that a spoken language (French, for example) is more complicated and not as good of a language as Russian. Well, if you KNEW Russian and not French, then clearly French is going to appear to be more difficult to read and understand. That doesn't mean one is better than the other, unless you happen to be living in Russia or France. For example, it's clear that English isn't your first language, so maybe you're just not understanding it, and maybe it makes you angry? Quick, what is the best spoken language in your opinion and what one is a bad choice to learn if you wanted to learn a foreign language?

    Actually, never mind, I see your problem. You're one of those people that bashes languages you don't understand. I just read over this thread: http://www.sitepoint.com/forums/showthread.php?t=573113 and after seeing you actually blame the PHP language because of how poorly a web host decides to set it up or fail to secure the server, I don't think debating about languages with you will get either of us anywhere. For your information, there are plenty of exploited scripts/programs that are insecure which are written in a lot of languages and use a lot of different API's/interfaces.

    The fact you continue to yell about how PHP is bad because someone decides to run it insecurely and in the Apache API as a module and without any real security settings, shows you know nothing about the most basic things regarding the languages and how they are ran. The user PHP scripts run as have *nothing* to do with the language. For your information, Ruby and Python can run as the global web server user (nobody) as well, and on a poorly set up server, you can still read other user's files. That's not the language's fault, it's the server admin's fault for not setting up a secure web server environment.

    A poorly coded script doesn't mean the language is poor. An insecure script doesn't mean the language is insecure. An insecure server setup doesn't mean the language is insecure. For example, we run PHP with the suPHP wrapper and PHP scripts run as the user's own ID, not the global web server user (nobody). We implement many things to run it securely, but it's not the language, it's the interface and how it runs in the web service. I'm not going to get into a debate, especially if it's not based on anything legitimate. I'm not upset that you feel the way you do about Perl, but for God's sake, man, have a rational and valid reason to argue that a language is bad.
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    http://www.burlyhost.com/ Shared Hosting, Reseller Hosting, more!
    Industry's most experienced staff! -- Web Hosting With Muscle!

  12. #12
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Offtopic: PHP for me is not just language but how it is used. When I spoke about PHP I mean how it is used usually. (I think php thread is closed if you wish to reopen it then we will talk in different thread not here)

    I have programmed multi-process daemon many years ago in Perls + many cron tab scripts.
    I remember that default Perl build does not support threads and many perl modules are not thread safe.

    I think Python has a better threads support.

    What is important for me is that Perl is hard to read. It is hard to read perl code.
    When I firstly read Python code I understood it.

  13. #13
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,039
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by max7 View Post
    What is important for me is that Perl is hard to read. It is hard to read perl code.
    When I firstly read Python code I understood it.
    Please don't formulate your opinion as a fact. I'm sure there are people out there that find Python hard to read, and Perl easy.

    Like The Greer tried to explain to you several times, its a matter of opinion. It's okay to express that opinion, but right now you're only using the authority argument to try and win some argument that can't be won, because there is no "good" and "bad" in this matter.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  14. #14
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. That is my opinion but we are sharing our opinions about Perl vs Python

    Let wait when someone will tell that python is harder to read or more complex to learn.

  15. #15
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by max7 View Post
    Ok. That is my opinion but we are sharing our opinions about Perl vs Python

    Let wait when someone will tell that python is harder to read or more complex to learn.
    The problem was your first "opinion" was so one sided and not correct (although it is an opinion so there might not be a correct or incorrect) there is no way to want to agree with anything you said. My experience is that perl is harder to learn, not by much, python is easier to read, but not by much.

    Does one outperform the other? Depends on the application. Perl makes writing real world applications fast and easy, python might too but I don't have enough experience to say with any authority.

    That ends my participation in this thread.

  16. #16
    SitePoint Enthusiast Tim Greer's Avatar
    Join Date
    Aug 2001
    Location
    California, home of the bear...
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by max7 View Post
    Ok. That is my opinion but we are sharing our opinions about Perl vs Python

    Let wait when someone will tell that python is harder to read or more complex to learn.

    Okay, how about this then; I was using Perl back before Python was created. A few years after Python was more popular, I looked into it and attempted to browse over some code. It was more difficult to read and understand. Why? Because it was new to me and I knew Perl well. Does that somehow mean that Python wasn't as good as Perl? Of course not. So, at that time, Python was indeed more difficult to read. As for how "complex" a language is, I suppose if you don't know it at all and try and understand it, it'll appear to be complex. Anything will be complex in appearance if you don't know it. I really don't see any room for debate here, and continuing this conversation would be a waste of time better spent on other things.
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    http://www.burlyhost.com/ Shared Hosting, Reseller Hosting, more!
    Industry's most experienced staff! -- Web Hosting With Muscle!

  17. #17
    SitePοint Troll disgracian's Avatar
    Join Date
    Aug 2006
    Location
    Samsara
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably the biggest difference off the bat is that Python uses whitespace (ie, indentation) as syntax, in that it is required. I don't know of any other language that does this.

    Python's OO implementation is probably better than Perl's (or at least a bit more intuitive). I love Perl but I'm not a fan of writing OO code in it. On the other hand, Perl's regular expression implementation is a lot more intuitive than Python's (and just about every other language as well). Regexes are a bit of an arcane tool, but incredibly useful once you get familiar with them.

    Perl and Python are pretty ubiquitous too. Perl comes with just about every modern Linux/BSD distro (I think Python does too) and both are available on Win32 platforms as well.

    I don't know nearly as much about Python as I do about Perl, but I think you'd be fine doing either. I think Perl is falling into disuse as a web language in recent years, but it's still arguably the most useful sysadmin's scripting language.

    Cheers,
    D.

  18. #18
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,039
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by disgracian View Post
    Perl comes with just about every modern Linux/BSD distro (I think Python does too) and both are available on Win32 platforms as well.
    Python didn't come in the box with my Debian 4 (Etch) installation, had to add it manually.
    I believe Perl came in the box
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  19. #19
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Location
    Klagenfurt / Austria
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you could stretch that buy saying that there are official packages for it for about any distribution without having to otherwise configure or leave apt-get :-)

  20. #20
    SitePοint Troll disgracian's Avatar
    Join Date
    Aug 2006
    Location
    Samsara
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it's probably just a single shell command away on any distro.

    Cheers,
    D.

  21. #21
    SitePoint Member
    Join Date
    Sep 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This thread really gets my attention. And it is the reason I have just registered for an account here he he he

    I just want to share my thought. IMO, I don't like OOP. I find Perl is fun. The coding styles are individual's preferences as long as the languages have enough capabilities and Perl, Python, Ruby, C, C++, Java, C#, ... so so many languages have that. So it seems the languages of choices are of what people like.

  22. #22
    SitePoint Member ideamonk's Avatar
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've hardly written more than 10 lines of perl, but when it comes to a comparison, I have the following views -

    Perl -
    Tough to maintain,
    Rampant use of regexp and $_ special variable makes it little tough to read the code.

    Python-
    Easy to read and write,
    Large number of frameworks available for web development - (flask, web.py, django, google appengine)
    Easy to learn, equally easy to teach,
    Plethora of modules available to do any kind of task.
    Unit testing,
    and many more

  23. #23
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ideamonk View Post
    I've hardly written more than 10 lines of perl, but when it comes to a comparison,
    That is entirely due to your relative experience of the languages.

    In general I find that those languages I use the most are the ones I find easiest to use. Between those I use equally infrequently I find those I have known for longer easier to use.

    With regard PERL and Python there is also the difference in the type of language that each is and if one of those languages is the only one of that type that you have encountered then of course it will be harder to understand than if you know several other languages of the same type.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  24. #24
    SitePoint Member ideamonk's Avatar
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Between those I use equally infrequently I find those I have known for longer easier to use.
    Can't agree more to you. I always find PHP as the most comfortable than any other language I know for the mentioned reason.

  25. #25
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,273
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    I've hardly spoken more than 10 lines of French, but when it comes to a comparison, I have the following views -

    French -
    Tough to speak,
    Rampant use of silent letters and accents everywhere makes it little tough to read the language.
    Sure. And with less than 10 lines of French, it's very likely that it was bad, hard-to-understand French. Exactly what one would expect, really, and that's normal. Everything looks Greek to you if it's unfamiliar.

    Python-
    Easy to read and write,
    Large number of frameworks available for web development - (flask, web.py, django, google appengine)
    Easy to learn, equally easy to teach,
    Plethora of modules available to do any kind of task.
    Unit testing,
    and many more
    Hahahahahahhaha
    hahahahahahahaha
    hgahahahahaha

    Let's try this again.
    Perl-
    Easy to read and write (IF YOU ACTUALLY KNOW PERL)
    large number of frameworks available for web development - (catalyst, cgi::application/titanium, gentry, webgui, jifty, mojomojo, I'm missing about 20 more)
    Easy to learn, equally easy to teach (Perl is like learning to drive: it's easy to drive after you've learned to do it, but until you have, you drive badly... but nobody goes around complaining about how hard it is to learn to drive or teach driving)
    Plethora of modules available to do any kind of task (hello CPAN)
    Unit testing,
    and many more

    I find excessive whitespace HARDER to read but that's me... there's someone on this forum who finds syntax highlighting impossible to read, while for most of us it's way easier. I indent my code, but a clean one-liner with a ternary operator (which when finally added to Python is done differently from other popular languages) is (for me) preferable to giving every word a new line and tabbed in.
    Code:
    There
            is such a
                    thing       as         too       much
            white
    space
    mak    ing     things                  much                    harder                 to read.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •