Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Thank 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?


From '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 ">;


> 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: