3 ms·
Genuinely curious - and not trying to be a jerk... but where do you find Perl fits well? I can only imagine needing it if I'm stuck on a legacy OS/strictly gove
by folkhack 7y ago
Genuinely curious - and not trying to be a jerk... but where do you find Perl fits well? I can only imagine needing it if I'm stuck on a legacy OS/strictly governed environment where it's the only option I have. (ie: governmental work etc.)
- notyourday 7y agoBrain dead workers. Ask what to do. Fetch the needed data. Do the thing with that job. Signal job completion or failure. Die. Wait for a supervisor to restart you for the next job.
- yellowapple 7y agoYep. Nowadays Erlang (or Elixir) would be my tool of choice for that, but before discovering those (or when that felt like overkill) a quick Perl script would be my way to go. Incidentally, apply this to web requests/responses and you've invented CGI (where Perl was incredibly useful, even if PHP happened to be a bit more popular).
- Grinnz 7y agoOneliners that range from simple text processing to complex magic. Wonderful web applications in Mojolicious. Lexical scoping and strict variable checking. Four strong event loop ecosystems, futures and promises, and an in development async/await syntax all for collaborating asynchronous tasks. Great integration with shared libraries through XS and FFI. A consistent culture of documentation and testing for everything on CPAN. And mainly, familiarity with the language.
- amalcon 7y agoNot grandparent, but to me, Perl's niche is short log-processing scripts (like, 200 lines or fewer). Once it looks like it will either need an input other than a text file or grow to a significant length, I tend to rewrite in something else. However, for short log processing scripts, I've not found anything with even close to the same productivity.
- __jal 7y agoPerl is really great at text processing. Pretty much any kind. A lot of folks dislike first-class regexes, but if they're magic in a lot of contexts like this. My second remaining use is experimental coding. It is probably about familiarity and experience (I've been writing perl since Perl 4), but I find it to be the most fluid, most "fun" language for noodling around and trying out ideas. I use Python for things other people will have to work on, because it is the current popular kid, so most folks have at least seen it. Not because I especially like it - the GIL is still a performance killer, purity of essence arguments keep obviously useful things (like case statements) out, and (as I'm sure will be demonstrated shortly) there are always annoying people around to condescendingly tell you why you're wrong to want things like case statements.
- DonHopkins 7y agoYou say "magic" as if that were a good thing. Which magic do you mean: supernatural, illusion, or fiction? https://en.wikipedia.org/wiki/Magic https://en.wikipedia.org/wiki/Magic >Magic may refer to: >Magic (supernatural), a set of beliefs and practices distinct from religion and science https://en.wikipedia.org/wiki/Magic_(supernatural) https://en.wikipedia.org/wiki/Magic_(supernatural) >Magic (illusion), the art of appearing to perform supernatural feats https://en.wikipedia.org/wiki/Magic_(illusion) https://en.wikipedia.org/wiki/Magic_(illusion) >Magic in fiction, the genre of fiction that uses supernatural elements as a theme https://en.wikipedia.org/wiki/Magic_in_fiction https://en.wikipedia.org/wiki/Magic_in_fiction
- Grinnz 7y agoIn this case, it's a Perl concept related to DWIM (Do What I Mean), where the features will make practical assumptions about what you need to accomplish in their implementation, so you don't have to worry about the details. It can be abused (and is) but is also very useful for quick oneliners in particular. Not to be confused with the Perl feature called magic, where functionality can be attached to a variable to affect what happens whenever it is accessed. Though this is often used to implement the former concept.
- yellowapple 7y agoIf it involves a lot of text processing, Perl tends to be either my first choice or pretty close to it. Perl's also surprisingly fast for an interpreted scripting language (especially when it comes to text processing). I've used it pretty heavily for system automation tasks, too, and thus generally continue to do so unless there's some specific reason why I'd need to use a different language (and usually there ain't). I've heard that Perl's also massively popular in the genetics/bioinformatics world. I'm assuming a lot of their data is in textual formats, and thus would benefit from a language that's fast at processing that data. I have no experience here, though.