Hacker News new | ask | show | jobs
by anon9001 2376 days ago
Here's a perl one for fun :)

  perl -MList::Util=shuffle -0ane 'print ((shuffle @F)[0..3],"\n")' < /usr/share/dict/words
1 comments

Why thank you :)

From the perspective of someone who's just getting started with learning to code, perl seems like a pile of spermaceti: was once very important, could be turned into beautifully smelling products so long as you didn't pay too much attention to the production process, and no longer needed because of modern synthetics :)

But I've only ever read people mocking perl, never built anything with it. It appears immensely powerful, but collapsing arrays by default makes no sense at all.

Perl's problem is that it's more confusing than it is powerful.

I think most of the people who were into Perl for the "beauty" ended up going to ruby.

People who were into it for CPAN went to python.

You might find this interesting, as you can see the spirit is alive and well: https://github.com/learnbyexample/Command-line-text-processi...

  ruby -0ane 'print $F.shuffle[0..3].join,"\n"' < /usr/share/dict/words
If you're intrigued by the idea of perl one-liners, go explore ruby.
I will, I hope, someday. I want to get an intermediate knowledge of Lisp, or C, or Rust first I think. I know a bit of Python, and think I'd prefer to learn something more different than it next. My impression is that Python is a less whimsical more enterprise-y and conformist sibling of ruby.
My unsolicited advice: Don't worry too much about specific languages. The most valuable thing you can do is get a strong command of *nix and solve a lot of real-world problems with it. Make it your desktop OS and spend a lot of time with it. Build yourself a router. Make a RPi do something to improve your life. Take some cloud service you use and figure out if you could do it the libre way yourself. Build your own NAS. Bonus points if you learn vim or emacs while you're doing it.

Don't worry too much about the meta-narrative about the culture associated with each of the languages. The surveillance state is being built with python, but a lot of hardware hackers prefer python too. Ruby is praised for its flexibility, but its most successful project is literally called "Ruby on Rails" because it tells you exactly how to do everything.

The way people feel about languages goes in cycles, so it's good to be aware of it, but you can mostly ignore it. Use the best tools for the job. If the job is making computers do things, the best tool is unix :)

Thank you for the advice. I'm trying two now: Ubuntu for my daily driver, Emacs (with spacemacs to simplify config for now) for most writing.

I bought an rpi, but could never figure out something to do with it. Any suggestions?

My feeling with languages is that they may go in cycles but it'd be useful to learn either something with a completely different conceptual model (Lisp) or requiring me to understand pointers. But I'd been thinking about trying to lean Unix instead lately.

I feel like I'm pointing a flashlight around a cave with Linux systems. Any advise for some systemic learning? My cs curriculum won't cover anything that applied.

> Thank you for the advice. I'm trying two now: Ubuntu for my daily driver, Emacs (with spacemacs to simplify config for now) for most writing.

If you don't know either of them yet, I'd suggest vim ;)

> I bought an rpi, but could never figure out something to do with it. Any suggestions?

Pi-hole is a super popular project, maybe give that a try.

> or requiring me to understand pointers

Maybe learn to do some old-school stack smashing? https://insecure.org/stf/smashstack.html

There are a bunch of CTFs out there you can play with that help build skills.

> I feel like I'm pointing a flashlight around a cave with Linux systems. Any advise for some systemic learning?

Sounds like you're on the right path :)

Maybe try doing http://www.linuxfromscratch.org/lfs/read.html if you really want a deep understanding of how Linux works.

Also, just browsing the Linux documentation is useful: https://www.kernel.org/doc/html/latest/

Or Raku https://raku.org:

raku -e 'say lines.pick(4).join' < /usr/share/dict/words