I will say, even as a hardened Perl nerd and user since 4.036, some of these tasks I’d probably reach for awk first even though Perl subsumes (and was designed to subsume) most of its use cases.
I find Perl especially useful for processing data separated by an empty line. By setting $/ to the empty string, “paragraph mode” is activated. You can do this on the command line by passing the -00 option:
perl -00 -ne 'print if /something/'
# prints paragraph if it has "something" in it
I will say, even as a hardened Perl nerd and user since 4.036, some of these tasks I’d probably reach for awk first even though Perl subsumes (and was designed to subsume) most of its use cases.
Yeah, I reach for sed or awk first too. Perl helps when I need more powerful regexp features and other built-in goodies.
I find Perl especially useful for processing data separated by an empty line. By setting $/ to the empty string, “paragraph mode” is activated. You can do this on the command line by passing the -00 option: