-
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.
-
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.
-
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.
-
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++.
-