Re: Preferred language?
Joel Roth <[email protected]>
| Newsgroups | gmane.linux.distributions.gobo.general |
|---|---|
| Message-ID | <20150329235450.GA28899@sprite> |
Sergio Tortosa Benedito wrote: > As much as I see you seem to have Perl knowledge, so from your point of > view (be as subjective as you want :) ), which one is more "readable"? > (whatever you understand that means), I'm initially asking in a Perl vs > Python, but feel free to add any language you consider. There is a learning curve in any language. For me, perl is more readable to me, because I'm used to its conventions. One thing that is more complicated in perl, is the notion of context. For example, the function localtime() will return a list of values if assigned to an array, or a datetime string if assigned to a scalar. $now = localtime(); # Sun Mar 29 13:43:32 2015 @now = localtime(); # 9,43,13,29,2,115,0,87,0 I did do some packaging and maintenance work on a python application once. It forced me to learn a little of the python syntax, and I think it's reasonable, but there are some gotchas. Having whitespace define code blocks seems fragile to me. Matched braces make it easy to find the beginning and end of the code block. With matched braces, you don't have to change indents when moving code, so your version-control commits can be cleaner. But I will frankly admit that those were not criteria that brought me to use perl to begin with. (I wanted to learn one language, instead of shell, sed and awk.) One other issue in choosing python is selecting version 2 or version 3. https://wiki.python.org/moin/Python2orPython3 Generally, you want version 3 for unicode support, but some libraries aren't yet ported to version 3. Perl 5 vs. 6 faces some similar issues. Perl 6 represents far deeper and more radical changes over its predecessor than Python 3. And few libraries are available. However tools are being developed to use perl 5 libraries under perl 6, and vice versa. Finally, because perl syntax is more complicated than pythons (there, I said it!) there is lots of ongoing work to be able to modify and transform syntax. Some perl OO scaffoldings and frameworks take advantage of this. That there are so many such frameworks is considered a minus by some. However, it also indicates a richness are of technology development. You learn what you need. Hey, well, keep us posted what you find out! Joel > --Sergio > 2015-03-29 21:17 GMT+02:00 Joel Roth <[email protected]>: > > > I had written: > > > > > > The best references (no pun intended) for perl nowadays are > > > > Learning Perl by Randal Schwartz, Modern Perl by chromatic, > > > > Beginning Perl by Curtis Poe. The latter two are free to > > > > download. > > > > Sergio Tortosa Benedito wrote: > > > Hey thanks I'll try to read them (I'm taking modern perl as it seems to > > be > > > more direct, though I guessed that only eith the title so I may be off > > > track). > > > > They're great books written by great programmers. > > > > Oh, and one other reference for perl is the Perl Monks > > website, http://perlmonks.org . Useful to search, and a > > friendly community. If you can post sample code and a clear > > question, you will almost certainly receive help! > > > > Back to the question of languages, I believe Python > > is somewhat easier than Perl for calling into C libraries. > > For day-to-day scripting, I think you can use pretty much > > any language you like, whatever fits your mind better. > > > > (They say for a flexible mind, you should learn several > > languages.) > > > > cheers, > > > > Joel > > > > > > -- > > Joel Roth > > > > > > _______________________________________________ > > gobolinux-users mailing list > > [email protected] > > http://lists.gobolinux.org/mailman/listinfo/gobolinux-users > > -- Joel Roth