Thread: c++& perl

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    10

    c++& perl

    A friend of mine is trying to persuade me into learning perl instead of c++ as its easier to learn and requires less effort on the programmers part because c++ requires many tasks such as a lot of low level mangement of resourses (like memory). He may be a bit biased in his opinion so i came here for a second opinion. Any help would be much appreciated.

  2. #2
    Registered User Dr. Bebop's Avatar
    Join Date
    Sep 2002
    Posts
    96
    It depends on what you plan on doing. Perl is a scripting language which makes it pretty slow compared to C++ which is close enough to the machine to be really speedy. Perl is great for handling strings and stuff, C++ isn't as good. C++ in my opinion is easier to learn because perl has so many operators to give it that many ways to do one little thing feature. I think that you should learn C++ and then go to perl because you can use what you learn with C++ when learning perl or any other higher level language.
    Processing error: Stupidity detected.
    ------------------------------
    Dr. Bebop
    Windows XP Professional Ed.
    Microsoft Visual Studio 6

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    82
    I agree with Dr B, in that you'll learn more by learning C++ than by learning Perl. That said, I love Perl with a passion and I think that it should certainly be the second or third language you learn. There are some things for which it absolutely blows C++ out of the water, such as text processing. If you've been keeping up with the thread about counting the words in a file, which has been giving Achillles fits, you can do the same thing in Perl with just a few lines of code:

    Code:
    use strict;
    open(IN,"test.txt") or die;
    my $num_words = 0;
    while(<IN>) {
        my @words = split;
        $num_words += scalar(@words);
    }
    print $num_words;
    Pardon the non-C++ code but it seemed appropriate for the topic. Also, if you're going to do much server-side dynamic web content, Perl is probably the best-documented and -supported language for such things.
    Claus Hetzer
    Compiler: Borland 5.5 (on Windows)
    Solaris CC (on Unix)
    Known Languages: C++, MATLAB, Perl, Java

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    82
    Oh, and as far as your friend's arguments, he is correct in that Perl is easier to learn and requires less effort, but you also get much less out of using it. Depends I guess on whether you want to learn to be a good programmer or to write scripts that will get the job done with little effort. Make no mistake, you will be productive sooner with Perl, but you'll be a much better programmer with C++.
    Claus Hetzer
    Compiler: Borland 5.5 (on Windows)
    Solaris CC (on Unix)
    Known Languages: C++, MATLAB, Perl, Java

  5. #5
    Registered User
    Join Date
    Aug 2002
    Posts
    10
    thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C structure in perl typemap
    By rotis23 in forum Linux Programming
    Replies: 1
    Last Post: 07-16-2003, 11:13 AM
  2. de facto perl book
    By rotis23 in forum Linux Programming
    Replies: 1
    Last Post: 05-22-2003, 04:43 AM
  3. perl program question
    By newbie2c in forum Tech Board
    Replies: 2
    Last Post: 02-03-2003, 10:19 AM
  4. From Perl to C
    By Heavenstrash in forum C Programming
    Replies: 4
    Last Post: 06-19-2002, 01:22 AM
  5. perl need help pls.....
    By magnum38 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 12-12-2001, 10:35 PM