6 ms·
I don't mind Perl, and I like that it's installed on every Linux distribution I'd ever use by default. The problem I have is that I find it unpleasant to work w
by bachmeier 4y ago
I don't mind Perl, and I like that it's installed on every Linux distribution I'd ever use by default. The problem I have is that I find it unpleasant to work with text files. Examples:
https://perlmaven.com/open-and-read-from-files https://perlmaven.com/open-and-read-from-files
https://stackoverflow.com/questions/1045792/how-can-i-list-all-of-the-files-in-a-directory-with-perl https://stackoverflow.com/questions/1045792/how-can-i-list-a...
I simply cannot remember that stuff, and frankly it's too much hassle. I want to make one call to a simple, built-in function to load a text file, and similarly for looping over the files in a directory. I find Bash plus other Linux tools to be easier than Perl, even though most everything else is easier in Perl.
- Zhyl 4y agoI actually find this one of the easier things with Perl. Just add one `while` loop over the diamond operator and then pass the files to it via bash globbing.
- BaseballPhysics 4y agoAgreed, I find the GP comment kind of bizarre. Like, the thing Perl is truly great at is processing text files. Hell, it's one of the main reasons I use it (that and as a general replacement for shell scripting when I need to do anything moderately complex). And if you really wanna deal with files and directories, IO::File and IO::Dir are easier interfaces to work with and there's plenty of other helper modules out there. I'd never use the base primitives as described in that article. Mix in File::Find or equivalent and Perl is incredible for file handling.
- darrenf 4y agoPath::Tiny really is your friend here. https://metacpan.org/pod/Path::Tiny https://metacpan.org/pod/Path::Tiny