LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2009, 08:50 AM   #1
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Rep: Reputation: 15
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?!
 
Old 03-19-2009, 09:35 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mannclay View Post
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.
 
Old 03-19-2009, 09:48 AM   #3
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 510

Rep: Reputation: 53
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.
 
Old 03-19-2009, 11:17 AM   #4
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
Old 03-19-2009, 11:45 AM   #5
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by Su-Shee View Post
Perl is still somewhat the swiss army knife of the Internet
That isn't exactly how Perl is commonly described.
  1. linky
  2. linky
  3. linky
 
Old 03-19-2009, 11:47 AM   #6
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 510

Rep: Reputation: 53
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.

But you have to obey it by yourself.
 
Old 03-19-2009, 02:44 PM   #7
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Original Poster
Rep: Reputation: 15
this was very helpful, guys.

I think I will continue with Python and Perl script languages simultaneously...

Plus, I do like the *nix environment and will probably end up coding well with Perl soon.
 
Old 03-19-2009, 04:11 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
(Shrug...) It worked well-enough for me.

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.
 
Old 03-19-2009, 04:53 PM   #9
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Original Poster
Rep: Reputation: 15
clearly understood.

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?

Last edited by mannclay; 03-19-2009 at 04:54 PM.
 
Old 03-19-2009, 09:32 PM   #10
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by mannclay View Post
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.
 
Old 03-19-2009, 09:39 PM   #11
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Like your friends said, Perl is *definitely* a useful thing to have on your resume.

It's also a very useful tool simply to know.

STRONG SUGGESTION: try to get a copy of "The Llama Book":
"Learning Perl, 5th Ed", Randal Schwartz:
http://www.amazon.com/Learning-Perl-.../dp/0596520107

IMHO .. PSM
 
Old 03-19-2009, 10:28 PM   #12
mannclay
Member
 
Registered: Nov 2007
Location: Brooklyn, NY
Distribution: eeeMint
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
Old 03-19-2009, 10:30 PM   #13
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quotations have been lightly edited.
Quote:
Originally Posted by ghostdog74 View Post
Quote:
Originally Posted by mannclay View Post
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 View Post
Perl is *definitely* a useful thing to have on your resume.
 
Old 03-19-2009, 10:43 PM   #14
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by mannclay View Post
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.
 
Old 03-19-2009, 11:30 PM   #15
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
A clarification:
Quote:
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!

IMHO .. PSM

Last edited by paulsm4; 03-19-2009 at 11:31 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is Perl a dying language? Micro420 Programming 37 05-31-2007 12:49 PM
Documents to learn C language and Perl/python satimis Programming 5 03-19-2004 10:20 AM
need some advice on language choice(Perl vs PHP) coolman0stress Programming 8 11-17-2003 04:41 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 08:09 PM
Perl programming AliceC Programming 4 05-17-2001 10:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration