Hacker News new | past | comments | ask | show | jobs | submit login

Perl is readable, just indent it.



What is the readable indented version of this?

   perl -anle '$w{lc s/[[:punct:]]//r}++ foreach @F; END{print map{"$w{$_} $_ \n"} (sort{$w{$a} <=> $w{$b}} keys(%w))}'


I wrote that as a one liner it’s not supposed to be readable. Here’s a readable version of essentially the same program:

https://perlmaven.com/count-words-in-text-using-perl


I know, I still have my black belt in perl somewhere. The one-liner is readable, too.

Throw in some needless array-referencing-and-dereferencing so people can rightfully consider perl a write-only language...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: