Is the Perl programming language useful?

AI Thread Summary
The discussion centers around the usefulness of programming languages, particularly Perl and Python, in the context of physics work. While Perl is recognized for its strengths in text processing and handling large datasets, it is suggested that Python is a better choice for physics applications. Python is praised for its clarity, ease of use, and extensive libraries like SciPy and VPython that are beneficial for scientific computation and visualization. Participants recommend Python for quick computations and suggest that learning C or C++ could be beneficial for more computationally intensive tasks, although these languages require a greater investment of time and effort. Resources for learning Python, including O'Reilly books and online tutorials, are also mentioned, emphasizing the importance of choosing beginner-friendly materials. Overall, Python is favored for its institutional support in physics and engineering, while Perl is seen as more suited for scripting and data processing tasks.
The_Z_Factor
Messages
70
Reaction score
0
Hello all, I was wondering, since I read in a document that programming is used a lot in physics work, if Perl programming was any use? I don't know much about programming or even computers for that matter all I know is that Perl is mostly a text based programming system and I assume that its not used because its not binary? I picked up a few Perl books and that helped me understand the basics, I didnt get too far into it before sending it back to the library, too much work going on at the time. But if I was to pick up a book at a library that would help me with later physics work in college, to get a basic idea, what type of programming should I try and learn? C++ or C? Any tips?
 
Technology news on Phys.org
I would probably recommend Python over Perl for physics. Python has a number of physics-related computation and visualization modules available, such as SciPy and VPython. It would be worth learning one of C(++) or Fortran for extremely computationally intensive tasks, but for most quick and dirty computations, Python should suffice.
 
Ah, thanks, any idea where I could find a book that could teach that? The only books my library has are JavaScript and Perl and C(++).
 
The o'reilly book learning python is pretty good.
Or the online tutotrials http://docs.python.org/tut/
For maths there is a (free) heavy duty numerical add-in http://numpy.scipy.org/

Python is as easy to use as Perl but has rather clearer and less confusing syntax.
 
Not so sure if I would say easy personally, haha. But thanks for the links, I'll definitely check them both out.
 
I'm going to echo these guys on the basis of personal experiences & preferences. "Serious stuff" ~ Python (which don't require or for some reason want to do e.g. with C++ or something related)(Python is being used & taken into use all over the place with respect to physics appls), "misc scripting, data processing etc." ~ Perl. Would also highly recommend to make sure you get a compiled language like C++ to your repertoire.
 
The_Z_Factor said:
I don't know much about programming or even computers for that matter all I know is that Perl is mostly a text based programming system and I assume that its not used because its not binary?
Perl has special capabilities that make it especially good for dealing with large text-like data sets; however it can work with "binary" and mathematics just the same as any other programming language. The difference is mostly a matter of what features of the language get the most focus.

Although I have used Perl for many years and am very fond of it, I must second (third?) the recommendation that you would be better off using Python. Python has many of the same advantages as Perl, but it is "cleaner". Perl has a lot of special rules that make it very quick and natural to use when you are writing small tools-- but, when you try to write large structured programs these special rules mostly get in the way. Also Perl is hard to learn, because the special rules make it so complicated, and it will teach you bad programming habits. Python on the other hand makes everything simple and clean and easily-organized. Python is also a good pick if you are going into physics simply because from what I hear Python has a lot of institutional support in the areas of Physics and Engineering. (Although for some reason Perl seems to be popular with Biologists!)

I DEFINITELY think that Perl/Python are better for your uses than C/C++. Those languages are a large investment, so to speak, and the ways in which that investment pays off will not be very useful to you personally. Perl and Python hide a lot of low-level things about programming from you, whereas C/C++ make those low-level things front and center. If you try to learn C/C++ you will probably spend all your time learning to be a "programmer" and very little actually getting anything done.

I don't know how best to go about learning Python though, sorry! But I have found that O'Reilly books are almost always good. If you go with O'Reilly though be careful though to get the "learning python" (is that the name?) book and not the "programming python" book, because the "programming python" book is all about advanced techniques assuming you already know the language. (I made this mistake once myself...)
 
I don't know a thing about physics programming, so maybe I should be ignored. On the other hand, maybe not, since I'm just echoing what's already been said.

There's some quote about Perl that I just can't seem to find that basically says that the problem with Perl is that if you write a program with it and then come back to look at it the next day, you won't have a clue what its supposed to do.

Programming in Python has been one of the best experiences of my programming life. It seems to make everything easy enough and the online tutorial/documentation is great. I would definitely use it for everything if I were still programming.
 
Back
Top