In the HN echo chamber, it seems like everyone who's anyone has moved on to ruby, rails, python, django, etc. Look into the every-web. My god, it's full of perl.
In the HN echo chamber, it seems like everyone who's anyone has moved on to ruby, rails, python, django, etc. Look into the every-web. My god, it's full of perl.
I was one of the skeptical developers at some point, but then I got hooked :).
Modern Perl changes the old rep alltogether. I encourage people to write well architected, maintainable, extensible code and follow design patterns regardless of the language of choice.
my $x = 1;
say "$x + 1 = @{[ $x + 1 ]}";
sub plus1 { $_[0] + 1 }
say "$x + 1 = ${\plus1($x)}";But since you called-out Python and Ruby, I'm curious what you meant.
In Python, for example, interpolation would look like:
print "I ate a %s for %s" % ('banana', 'lunch)
(or the newer way with nominally more keystrokes)
print "I ate a {0} for {1}".format('banana', 'lunch')
I've done plenty of PHP work and I get that I can do "{$varhere}" but for strings of any length or complexity it was totally common to use sprintf() an I have to assume the same readability principles apply in Perl?
print "I ate a $fruit for $meal"
Or
printf 'I ate a %s for %s', $fruit, $meal
> 'This is more readable Python in my opinion'
edit: variable names
Also, I agree that for this simple case, perl (and other's) simple dollar substitution is nicer.
A good IDE would be of much more help (and strong typing makes writing such an IDE way easier, but that is a different issue)
It is so hard to know that @ means array and % means a hash (key/value pair) haha.
Agreed. However, working for a company with more than one developer...
Also, it means one doesn't have to dodge keywords in naming their variables. Doesn't count for a lot but is nice.
- Bjarne Stroustrup