|
|
|
Ask HN: Why do people consider Ruby better than Perl or vice versa?
|
|
12 points
by budwin
5633 days ago
|
|
I've seen a lot of anti-perl, pro-ruby speak recently on HN and am curious for what reasons people find Ruby to be superior (esp. from people who have experience with both) I'm personally a fan of both (and continuously delighted by learning new things in both languages). I'm spending more time with Ruby lately because it looks like it's where the community is going and is fashionable these days, but I have no real major issues with perl itself. Perl is often a stereotyped as unreadable, but it's largely up to the writers of the code itself to make it _that_ illegible; it's not a consequence of the language. |
|
$foo is a scalar
@foo is an array
$foo[0] is the first element of @foo, instead of @foo[0]
As far as I know, Larry Wall's rationale as a linguist was that in English, one would say "this apple" and "these apples", but "this third apple" instead of "these third apple". The problem is that code isn't a human language, and obeying these rules doesn't make sense and puts additional cognitive strain on the programmer. Basically, having different syntax quirks for scalars, arrays, hashes, and file handles makes code unnecessarily weird, especially when combining them for things like multi-dimensional arrays.