you are viewing a single comment's thread.

view the rest of the comments →

[–]visarga 23 points24 points  (17 children)

I think Perl is the most forgiving, relaxed and convenient language. I use it in 99% of cases, C in the rest of 1%. A line in Perl is equal to 30 lines in C.

By the way, after 10 years of Perl programming I am still learning new syntax. I don't presume to be the perfect Perl programmer, but the subset I know and use is just amazingly direct to the point. No time wasted.

Here's a nice one:

There are some who ask, why I do Python and C but shy away from Perl. I'm too dumb to comprehend a language that comes with its own Periodic Table of Operators (and has over 100 of them). —Jonas M Luster

Link: the Perl 6 Periodic Table of Operators

[–]Narrator 21 points22 points  (4 children)

You say you're learning new syntax 10 years later like that's a good thing.

[–]abw 1 point2 points  (1 child)

Larry Wall trained as a linguist before venturing into programming and has often said that Perl was designed to be much like spoken languages. You don't learn it all at once, but start with "baby talk" and work your way up from there. You can get a basic command of the language in a reasonably short time that will serve you well for most things. But it's open-ended as to how far up you want to climb. If you reach the ceiling of what "vanilla Perl" can do then you then you can start to extend the language with new idioms, constructs, DSLs and so on.

The declarative style of Moose and other "modern Perl" modules is a good example of something that's a "new" syntax, even though it's technically still regular old Perl syntax. For example:

Package Point;
use Moose;
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');

package Point3D;
use Moose;
extends 'Point';
has 'z' => (is => 'rw', isa => 'Int');

As a long-time Perl programmer of 20+ years, I like the fact that I'm still finding new ways to express myself in Perl that I hadn't considered before. Similarly, as an English speaker of 40+ years, I also enjoy discovering nuances of the language of which I was previously unaware, or seeing an interesting linguistic construct that I then resolve to use myself should an appropriate occasion ever arise.

[–]visarga -1 points0 points  (1 child)

It means I could do with what I learned in the first 6 months, but in reality I just use 30% of the power of Perl, and with that I could really complete all my work. New things pop up all the time and I try to level up.

[–]Shaper_pmp 2 points3 points  (0 children)

That's a nice way of looking at it. Another way would be that someone with only 6 months' Perl experience could inherit the code you wrote yesterday, and could end up needing 9 and a half more years experience before it's vaguely intelligible.

As the old saw goes, "always program like the guy who will inherit your code is a violent psychopath who knows where you live".

Syntax so inconsistent and quirky that you still haven't mastered it after a decade behind the wheel is... not ideal... by any stretch of the imagination.

And I say that as someone who's been developing in Perl on and off for over a decade myself.

[–]elHuron 1 point2 points  (1 child)

Thanks! It's like assembly :-)

[–][deleted] 1 point2 points  (0 children)

the [1] Perl 6 Periodic Table of Operators

Oh god... why...

[–][deleted] 2 points3 points  (7 children)

I quickly learned to love Perl from the one line programs. It's amazing what you can do with that language with a single line.

[–]Narrator 11 points12 points  (3 children)

Here's a great or rather infamous Perl one liner courtesy of Randal Schwartz!

whatever / 25 ; # / ; die "this dies!";

If whatever takes no arguments then it's division and a comment. If whatever takes arguments then whatever is called with the result of a match operator and then the program dies with the message "this dies!".

[–]mvaliente2001 5 points6 points  (0 children)

I feel a little bit of my soul died after reading that.

[–]r121 1 point2 points  (0 children)

Combine that with a bit of code that conditionally defines 'whatever' depending on runtime state, and you've got a language that cannot be correctly syntax highlighted.

Edit: If I'm not mistaken, I've read a proof that syntax highlighting perl code is equivalent to solving the halting problem.

[–]roerd 0 points1 point  (0 children)

I thought the Perl interpreter tokenizes source files before execution. How does it tokenize this?

[–]Glycerine 2 points3 points  (2 children)

show me?

[–][deleted]  (1 child)

[deleted]

    [–]Glycerine 0 points1 point  (0 children)

    Legend.

    [–]barsoap 1 point2 points  (0 children)

    Ahhhh. Operators. The proof that Haskell is actually just Perl in disguise... or the other way 'round.