Live data from Hacker News

Learn Perl in about 2 hours 30 minutes

qntm.org

41–50 of 111 posts

Re: Learn Perl in about 2 hours 30 minutes

#41
post #40

If you really want to learn Perl, you must install the read-eval-print loop (REPL) utility. If you have never used this utility, I will have serious grounds to doubt your Perl skills. Unlike Ruby or Python (or most other modern high-level programming languages), Perl does not come with an interactive REPL shell, which makes no sense at all, since, due to Perl's obscure syntax, someone trying out Perl would benefit at…

simply: $ sudo cpan Devel::REPL also you can do this: $ perl -e 'print "Hello World!\n";'

Huh, I thought "everyone" used perlbrew now?

It has been on my todo to try the REPL for a long time, but since Perl is the most powerful command line tool in bash, I've never seen a reason to use an interactive tool.

  alias p=perl
  p -e '...'
  p -ne '....'
  # etc.
Edit: With powerful I didn't mean "rm -rf", etc. :-)

Re: Learn Perl in about 2 hours 30 minutes

#42
post #26

Earlier quoted context omitted.

Perl's advantage over bash/awk/sed is that you can test, organize, and maintain code more effectively. This may not matter if you are programming to solve tiny unrelated problems, but it's a waste of effort if you are doing similar things frequently. Python is basically Perl but with different syntax, libraries, and community.

Out of curiosity, what do you consider to distinguish one Turing-complete language from another aside from those three traits?

Semantics. For example, writing a program to read "2 + 2" and evaluate the result is going to be very different from Perl and Python in Java or C++.

Re: Learn Perl in about 2 hours 30 minutes

#43

I've been working with Perl programmers for just about ten years now and the one thing I've sadly learned is that while many folks claim to know Perl, but only a small group can do it well. (although granted you can apply this reality to any other programming language)

"Write once, read never" comes to mind.

So many single/double char operators which need to be memorised with Perl, before you can start comprehending the programs.

Not to mention Perl hackers used to pride themselves on super succinct code - in certain circles it use to be popular to include one liners to do complex stuff in email signatures.

(Not complaining though, Perl was the first language I used, and probably the simplest for text file processing in CGI's back in the day.)

Re: Learn Perl in about 2 hours 30 minutes

#44
post #29

Sam, you've certainly made an enemy out of every member of the Perl community with this sarcastic and incomplete post. Once you've gotten through OReilly's beginner Perl books and "Programming Perl", if you truly want to learn how to scale Perl in the enterprise, read Damian Conway's Object Oriented Perl. Once you can write solid consistent OO Perl, read "Apache modules with Perl and C".

I'm a fairly well-known member of the Perl community, and I thought it looked okay. I'm not angry and I'm not Sam Hughes' enemy.

Re: Learn Perl in about 2 hours 30 minutes

#46

I do wish he had mentioned the smart match operator ~~ as it nearly eliminates the confusion between EQ and ==. Of course, if you're dealing with legacy code, then you still need to understand both (or all three), but new coders might be well advised to start with smart match.

"Smart" match is a pile of shit, and anyone reading the manual description for it should conclude the same. You can't know what it does unless you can remember the details of a 23-item table.

It's undergoing major revision, and not a minute too soon.

Re: Learn Perl in about 2 hours 30 minutes

#47

Would it be beneficial to know this alongside of Python, or is it more used instead of Python?

That depends on what you want to do. If you want to do things with text, especially transforming text, Perl is IMO opinion better at that task. Perl has been the scripting language for me, but I'm thinking of changing to Python because of NumPy, SciPy and the libraries for numerical analysis and scientific computing. Python seems to be better than Perl in that area. This is a library issue whereas when it comes to te…

If you want to stick to perl, you might want to check out http://pdl.perl.org/ if you haven't already. You can do a fair amount of scientific computing with it.

Among other things it overloads the basic operators, so $a+$b will do the right thing, even if $a and %b are matrices/images, so it is very easy to "read" if you are a perl person already.

Re: Learn Perl in about 2 hours 30 minutes

#49
post #43

I've been working with Perl programmers for just about ten years now and the one thing I've sadly learned is that while many folks claim to know Perl, but only a small group can do it well. (although granted you can apply this reality to any other programming language)

"Write once, read never" comes to mind. So many single/double char operators which need to be memorised with Perl, before you can start comprehending the programs. Not to mention Perl hackers used to pride themselves on super succinct code - in certain circles it use to be popular to include one liners to do complex stuff in email signatures. (Not complaining though, Perl was the first language I used, and probably t…

So many single/double char operators which need to be memorised with Perl, before you can start comprehending the programs.

Nonsense. All you have to know is how to identify operators and how to use the documentation. The Modern Perl book covers that in a page or two.

Post reply on HN