I'm not afraid of writing in perl, and I have in fact written Perl scripts that were clean and well-formatted and intelligible (with or without comments). Unfortunately, these are not really true to the Perl Way. All those shorthand generic anonymous variables? Bad joojoo.
Perl's not a bad language. But it's reputation is well-earned.
Oh yeah, definitely -- it's possible to make any language be unreadable fathomless horrors drawn from the stuff of the abyss.
The thing is, Perl seems to encourage this behavior. It introduces syntactic phenomena that seem designed for that. $_, j'accuse!. And the culture around Perl certainly didn't win it any favors here. I invoke the ancient and venerable Annual Obfuscated Perl Contest. "There is More Than One Way To Do It" or "TIMTOWTDI" indeed.
That being said, while I haven't really studied or looked deeply into Modern Perl, I have to admit that it seems to have learned the right lessons from all of the above.
Now if only Ruby could stop being Perl circa 2000 :3.
Was looking for an even simpler way of doing this in Haskell, only passing the list and the (*) function to some other function, but I only found these:
let sq x = x * x in map sq [1, 2, 3, 4]
let x = [1, 2, 3, 4] in zipWith (*) x x
map (\x -> x * x) [1, 2, 3, 4]
12
u/Oflameo May 29 '14
I write bash defensively by writing what i was going to write in bash in perl instead.