3 ms·
This sounds interesting! The main reason I moved to perl instead of sed or AWK is for better control. Shell scripts don’t differentiate between variables and da
by rmilk 3y ago
This sounds interesting!
The main reason I moved to perl instead of sed or AWK is for better control. Shell scripts don’t differentiate between variables and data (anyone else still having nightmares from trying to escape quotes and meta chars in a shell?).
Perl gives you all the simple features from sed or AWK and adds useful (maintainable) foreach iterators, arrays, hashes, etc.
Recommend using Strict mode if you are new to Perl. It gives good guardrails against silly mistakes like not declaring or misspelling a variables, or accessing strings or numbers that aren’t the correct datatype.
- kagevf 3y agoThank you for the tip re: strict! Escaping - that's definitely a sore point. I feel like I get tripped up by embedded double quotes way too often - does perl have a good way to handle them?
- tod222 3y agoFrom 'man perlop': Customary Generic Meaning Interpolates '' q{} Literal no "" qq{} Literal yes -- where {} can be any bracket pair. my $string1 = q<a single quote '>; my $string2 = qq<a double quote ">;
- tod222 3y ago> anyone else still having nightmares from trying to escape quotes and meta chars in a shell? This was a major reason I downloaded Perl 1.0 off Usenet in 1987.[1] [1]https://news.ycombinator.com/item?id=36657782 https://news.ycombinator.com/item?id=36657782