3 ms·
I always want to like Perl, but I struggle to find use cases that aren't better served by Python or Go on the web side; or just straight bash on the sysadmin si
by d_e_solomon 4y ago
I always want to like Perl, but I struggle to find use cases that aren't better served by Python or Go on the web side; or just straight bash on the sysadmin side.
- calvinmorrison 4y agoPerl is really nice when you are passing a lot of data around compared to bash. Enough struggling with parsing and escaping and bash arrays and you'll be better fit for perl very quickly. Perl is also really fast to prototype with, with a lot of nice helpers for scripts like while(<>) { say $_; }, make writing oneliners/short scripts easy. I find Perl is a good fit above bash.
- d_e_solomon 4y agoThat's good feedback. I'll have to give another go.
- larrybud 4y ago> Perl is really nice when you are passing a lot of data around compared to bash I know some might consider this heretical, but have you considered Powershell for these type of scripts?
- GuB-42 4y agoPerl has much less footguns than bash, it is also more powerful and faster. No language I am aware of have more footguns than bash, with the exception of some other Unix shells. But really, I really like Perl for throwaway scripts and one-liners. Because of its syntax, Python essentially can't do one-liners, and generally, Perl code is shorter and quicker to write assuming you are experienced in both languages. But I agree that readability is terrible unless you are really careful. When my Perl scripts get a bit too big, slow, and less "throwaway", I tend to rewrite them in another language. Often C or C++ because I know these well but I guess that Go can work too. Python has some great features, it is simple and code is naturally readable, but for me it sits on an uncomfortable spot: not permissive enough for quick, throwaway code, and too permissive and slow for larger, maintained projects.