LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-17-2008, 04:41 PM   #1
memo007
Member
 
Registered: Feb 2005
Distribution: Debian, Kanotix, Kubuntu
Posts: 117

Rep: Reputation: 15
Starting to program in c or perl?


I was thinking going back into programming, i programmed little with C a while back. My question is, should i learn perl or C or in that case C++ and then go back and pick up on perl (since i wanna know both). And How long will it take me to get the syntax down in perl, since I've never done any perl. So C or C++ or Perl?
 
Old 09-17-2008, 04:50 PM   #2
dodona
LQ Newbie
 
Registered: Jan 2008
Posts: 6
Blog Entries: 1

Rep: Reputation: 0
Quote:
Originally Posted by memo007 View Post
I was thinking going back into programming, i programmed little with C a while back. My question is, should i learn perl or C or in that case C++ and then go back and pick up on perl (since i wanna know both). And How long will it take me to get the syntax down in perl, since I've never done any perl. So C or C++ or Perl?
check out python or even better ruby.
 
Old 09-17-2008, 07:04 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you remember any C, it may make more sense to go to that first, but Perl is easier. (Speaking as someone who has used both in serious work).
For Perl you'll want to bookmark these:

http://perldoc.perl.org/
http://www.perlmonks.org/?node=Tutorials

The book to start with is Learning Perl (aka the Llama book) http://www.amazon.com/Learning-Perl-...1695871&sr=1-1

if you want a book as well, but there are a lot of perl tutorials etc on the web.

A good C book is 'A Book on C' by Kelley & Pohl: http://www.amazon.com/Book-C-Program...1695981&sr=1-1
explains the lang and its examples line-by-line.
Obviously you'll get recommendations for this: http://www.amazon.com/Programming-La...1696115&sr=1-1
ie C Programming Language by Kernighan & Ritchie. A classic, but a bit terse for actually learning from scratch. Your call.

Hope those get you started. come back if you have qns.
 
Old 09-17-2008, 07:23 PM   #4
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by memo007 View Post
Starting to program in c or perl?
Starting to program what? What kind of program do you want to write? Unless you answer that question, recommending anything to you won't be wise.
 
Old 09-17-2008, 10:53 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Joining the chorus which says: "We can't tell you what to do."

This is like saying: "I want to work on cars, what tools should I buy?" Are you into body work, engine overhaul, wheel alignment, or maybe interior detailing?

Enough harrassment---you can not go wrong knowing C. It teaches discipline and it teaches all the common constructs---as such, it makes learning other languages easier.
 
Old 09-18-2008, 03:00 AM   #6
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by pixellany View Post
Enough harrassment---you can not go wrong knowing C.
You can. AFAIK, using OOP with C won't be as simple, as in C++/Python/Java.
 
Old 09-18-2008, 03:21 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
It used to be that the one language you wanted to learn first was Pascal. IMHO, the best learning language today is Python. The lessons and disciplines you learn will help later on if you want to learn C. C is the native programming language for most parts of linux including the kernel. C++ is the native language for KDE development. I've heard programmers say that when they write a graphical app, they do so for gnome because they don't care for C++. ( E.G. the person who started asterisk later wrote gaim, stated this in a TWiT FLOSS episode )

For web development, you would probably want to learn Java and Perl or PHP.
 
Old 09-18-2008, 04:41 AM   #8
elprawn
Member
 
Registered: Feb 2005
Distribution: Gentoo 2008
Posts: 138

Rep: Reputation: 15
Quote:
Originally Posted by ErV View Post
You can. AFAIK, using OOP with C won't be as simple, as in C++/Python/Java.
Can you use OOP in C? I know you have structs but there's no concept of class methods, inheritance, objects or encapsulation is there?
 
Old 09-18-2008, 05:44 AM   #9
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Quote:
Can you use OOP in C? I know you have structs but there's no concept of class methods, inheritance, objects or encapsulation is there?
Yes you can...
since the C syntax doesn't able you to implement these concepts, you have to use programming trick. Take a look at my answer to a previous post there:

http://www.linuxquestions.org/questi...semble-670270/

I give some link where these tricks are explained.

And to go further, "gtk" is written in pure C but is fully OO. And many parts of the linux kernel, and many other porjects...
 
Old 09-18-2008, 05:48 AM   #10
elprawn
Member
 
Registered: Feb 2005
Distribution: Gentoo 2008
Posts: 138

Rep: Reputation: 15
What advantages does it have over using C++?
 
Old 09-19-2008, 07:32 AM   #11
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by elprawn View Post
What advantages does it have over using C++?
Isn't bloated, compatible with more compilers, and you have control over everything.
 
Old 09-19-2008, 07:48 AM   #12
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
Quote:
Isn't bloated, compatible with more compilers, and you have control over everything.
I add that:

C is the best defined programming language regarding to its international normalization, there's "just" about 200 undefined / unspecified behaviors, this is far less than the C++ (and any other standardized languages) standard undefined / unspecified behaviors. This issue is _REALLY_ important for portability.

You can found a C compiler for almost all arch you can meet all over the world, from the smallest micro-controller to the biggest super calculator...
 
Old 09-19-2008, 08:07 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,642
Blog Entries: 4

Rep: Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933Reputation: 3933
A programming language is just "a tool for the job." So, probably the best thing to consider in each case is, "what's the job (this time)?"

Perl's strong suit is text-hacking... ripping strings apart to get things out of them, building so-called "hashes" to do lookups and counts, and so-on. Also, Perl gives you access to the vast CPAN library of (generally...) well-tested code.

Other languages that are in-vogue these days, like PHP and Ruby, of course provide similar capabilities. All of them are very-competently and efficiently written, all things considered. But... what language were they written in?

All of these languages are written using C or C++ or both, as well as "in themselves." And this, for me, pretty well sums-up "the job" that these two languages are best at: fairly low-level programming to do things, like "building other languages."

A single line of a high-level language program might involve the execution of tens of thousands of lines of underlying "C" code, all of which is therefore "at your beck-and-call." All that code, and you didn't have to write it, didn't have to debug it, don't even have to think about it.

I don't know what to tell you specifically about "what to learn." In time you will need to learn all of them. ("Tools for the job.")

Last edited by sundialsvcs; 09-19-2008 at 08:08 AM.
 
  


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
Starting perl alienDog Programming 1 11-02-2005 11:01 AM
Starting program with ./ AndyMCR Slackware 6 07-16-2005 05:57 PM
starting on perl ankscorek Programming 3 03-30-2005 09:48 PM
Starting to program in C snoopyswiss Programming 4 11-04-2004 09:38 PM
Starting to program ;) Need a little help gamehack Programming 1 12-29-2003 09:45 AM

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

All times are GMT -5. The time now is 05:10 AM.

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