inquiry to Perl monks about Perl as a first programming language
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
inquiry to Perl monks about Perl as a first programming language
On my way learning my first language (Python for 4 months now) and getting grips on basic programming fundamentals (data strucures,flow control, etc...). Someone told me to learn Perl if you want to do scripts and web work since I'll have a better chance getting my first gig... What do you Perl gurus think?!
On my way learning my first language (Python for 4 months now) and getting grips on basic programming fundamentals (data strucures,flow control, etc...). Someone told me to learn Perl if you want to do scripts and web work since I'll have a better chance getting my first gig... What do you Perl gurus think?!
Perl is conceptually different from Python in the important for me fields like its functional (opposed to pure procedural/OO) part, closures, autovivification of references, scoping rules and thus, when needed, better encapsulation (data protection) and code reuse.
I.e. from the point of view of features Perl looks to me like a more powerful than Python language.
In order to successfully write in Perl you must have strong self-discipline.
From practical point of view Perl has CPAN, and almost always one can find a module that implements typical (and not very) CS tasks.
I also find Perl quite natural from the point of view of human thinking, i.e. the barrier to translate human thought into Perl may often be lower in other languages, but you have to learn Perl well first.
As years go by I like functional more and more - elegance, compactness, power.
And Perl is exceptionally well documented - especially for - but not only - beginners.
Perl is still somewhat the swiss army knife of the Internet and therefore a programming language worthwhile knowing anyway - even if you do your web programming with PHP or Ruby and other things with Python.
Perl was my first programming language, but that was before Python, Ruby and PHP existed.
Wow... although I am total newbie no. 1, for some reason am enjoy how functions work... Also it seems that the strict typing in Python was nice but, I guess I can do Perl code and have my own strict coding practices. Why is it helpful to programmers the "everything is an object" approach in Python? And why all the fuss I see about scripting languages? I just want to learn good programming protocols and not sure if Python or Perl will offer that.
Well, object orientation is a common concept in contemporary programming and therefore languages are measured by their convenience and support to actually _do_ objectoriented programming.
And Python and Ruby support this.
And a method is not really that different from a function or subroutine - it's just a function more or less "knowing" to which class/object it belongs.
Perl does simulate this behavior with something called "blessing" in Perl and does object orientation with either a range of modules (Moose for example) or by doing it by yourself via blessing a hash, an array or a scalar.
Perl 6 will be fully equipped for both programming styles - perlish procedural with the usal "sub" and object oriented with "method".
Functional programming is also possible with Perl to an astonishing high level. (See the book "higher order perl" (http://hop.perl.plover.com/book/)
Wether or not your project is due to its size or complexity better off with OOP or due to a specific requirement a more functional way of programming or if you just need a smaller procedural script or something extremely fast - well, that's for you to learn to decide and to choose and to understand.
If you by "strict typing" mean the syntax rules in Python - Perl's philosophy is not to force you into clean code but supporting you if you want to.
Actually, "the more languages you know, the more you realize that they're all the same." Every one of them, of course, is different, and every one of them strongly reflects the culture and the biases of their designers. Usually, every one of them is accompanied by some kind of proclamation that "theirs is the One True Way," or in the case of Perl, "There's More Than One Way To Do It (TMTOWTDI)," a phrase that is uttered with equally religious fervor.
Having started with Python (and, presumably, with Django), definitely take the plunge into Perl, PHP and Ruby. You don't have to become a guru on any one of them, "and if you find yourself prophesying on their behalf or speaking in tongues, back off." Just acquire a knowledge of the lay of the land. That will be sufficient for now.
You are right that the languages 'work' in similar ways and surely I will stand clear of the programming language religious.
I just felt recently that Perl's usage may fit in with my interests or what I want to do for work that I'll learn it first and move up that ladder of similar languages (Python, ruby, maybe PHP). actually, not sure why I stay away from PHP, something that I can't explain keep me away from it. <?__weird__?>
Why do people say to stay away from falling in love with a language?
On my way learning my first language (Python for 4 months now) and getting grips on basic programming fundamentals (data strucures,flow control, etc...).
good choice for a first language.
Quote:
Someone told me to learn Perl if you want to do scripts and web work since I'll have a better chance getting my first gig...
Both Python and Perl does the similar things. So that someone is probably wrong.
Quote:
What do you Perl gurus think?!
why didn't you ask how the Python gurus think?
Post your question to comp.lang.python and see how they reply you.
whatever it is, I am not going to go into this topic again. As both of them do the same things, the only other reasons they are different is
1) how easy to program in them
2) how easy to read the code, even for beginners
3) other personal preferences...etc
The ultimate answer/suggestion i can give you is learn them both and find out for yourself.
OH, I am not stopping from learning Python, its just about what skills do I need to know to at least get my first programming gig... Python taught me about flow control and data structures and when I saw Perl, they are similar yet are different. I see no beginner gigs for Python yet Perl has been around much longer and thought that knowing how to solve problems in Perl may help me get my first gig. I'm on my own in this quest for IT work and not sure that Python will offer me my first gig although its much easier to read and understand. I am not afraid of Perl's hieroglyphics.
Someone told me to learn Perl if you want to do scripts and web work since I'll have a better chance getting my first gig...
Both Python and Perl does the similar things. So that someone is probably wrong.
There should be a distinction made here between the utility of the language, and the utility of the language as perceived by your potential professional overlord. mannclay is referring to the latter; I believe ghostdog74 is referring to the former. paulsm4 refers to the latter when he says:
Quote:
Originally Posted by paulsm4
Perl is *definitely* a useful thing to have on your resume.
Wow... although I am total newbie no. 1, for some reason am enjoy how functions work... Also it seems that the strict typing in Python was nice but, I guess I can do Perl code and have my own strict coding practices. Why is it helpful to programmers the "everything is an object" approach in Python? And why all the fuss I see about scripting languages? I just want to learn good programming protocols and not sure if Python or Perl will offer that.
Everything being or object or not is not good/bad by itself.
Perl has its OO model which, according to Larry Wall, was stolen from Python, and he now regrets it.
The good things are:
robustness;
reusable code;
.
OOP is _a_ way to achieve the above, but not the only way.
For example, encapsulation and abstraction can be achieved in functional programming - if you are interested, I can publish some examples. And the examples will most likely show the difference between Perl and Python - according to my limited Python knowledge you won't be able to implement the same concepts in Python.
Anonymity is a _very_ strong feature helping to achieve robustness - as I wrote earlier, readily available in Perl.
There should be a distinction made here between the utility of the language, and the utility of the language as perceived by your potential professional overlord. mannclay is referring to the latter; I believe ghostdog74 is referring to the former. paulsm4 refers to the latter
Actually, I was trying to say Perl has both: "perceived utility" (e.g. by potential employers, giving you an edge in winning that gig), and "genuine utility" (Larry Wall, I believe, referred to his creation as "swiss army knife, or duct tape, of the web...").
Anyway, I definitely think Perl is a good choice (one of many; and for many different reasons).
And I'd like to emphasize: if you're interested in Perl, definitely consider getting "The Llama Book". It's great!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.