The general advice here seems to be “learn Perl while young”
The general advice here seems to be “learn Perl while young”
I don't think anyone tried seriously addressing that use case after Perl. Like, obviously you can do text processing in any language, but you're not going to be doing it in the context of shell pipelines and one-liners. The preferred interaction modes are totally different.
It seems like fewer even want to learn a shell pipeline.
But I would love to know if there is a non-regular expression language with native support for csv, json and yaml that one can pipe files in and out of.
I generalised your statement for you. When people learn anything in their youth, they tend to think of it as "better | easier | True".
It's true for the things we call culture, language, religion, and relatively simple phenomena such as cuisine and programming languages.
We form a personal canon from the first cognitive imprint. It is hard for people to change even when confronted with bias. The programming community is no exception.*
* pun intended
>>The general advice here seems to be “learn Perl while young”
Best time to a plant a tree was 20 years back, Next best time is now.
- A Chinese Saying.
https://english.stackexchange.com/questions/603690/origins-o...
Seems like it _may_ not be Chinese. I've often seen it attributed as Chinese. Funny how that sticks.
This works because perl is layered. To do even fairly elaborate awk-like text processing you only need to learn a little perl. Nothing like all of perl. To do the rest (of elaborate text processing), you learn a little more. In the end, most likely you never need to learn all of perl. But it's there to add to your toolbox as needed as you go.
I find piping into python to be a lot more than 2-3 lines before I'm even ready to do any manipulation of input, which again can get quite verbose. So I'm guessing it is not python.
echo -e "foo 1\nbar 2\nbaz 3" | ruby -n -e 'BEGIN { puts "===" }; $_ =~ /^b\S+ (.*)/ and puts "#{$_.chomp.upcase} => #{$1}"; END { puts "===" }'
There's -p too, -0777 works for slurp mode, throw in -rjson to get battery-included pretty_generate, interpolation can be nicer, but $_ is not implicitly used so it can get a bit more verbose than Perl.Perl had three huge advantages (at least for me) when I first used it in 1992: 1: familiar syntax which paralleled well-loved tools (sed, troff, grep) 2: associative arrays as a built-in 3: regular expressions as a top-level language feature (not buried in some library with clunky syntax). A few years later, CPAN was another huge advantage.
Nowadays, syntax compatibility with sed is a disadvantage not advantage, associative arrays/dictionaries exist or are easily available for basically every language, and CPAN was the model that everybody else copied or did better. So really the "regexp syntax is immediately available" is the only remaining advantage, and it's rare that it would be worth it.
I think what people are actually saying is: "Perl was great in certain regards, back when I could expect my colleagues to understand Perl, which incidentally was when I was young"
It may take many more likes to apply a regex in any other language - but if my colleagues know Python but not Perl, saving 10 minutes of coding will cost me 5 hours of training/coaching/debugging after the code has been 'maintained' by someone who doesn't know their $_ from their ->@*
I personally find python most useful to learn, especially in combination with invoking a real editor to edit multi-line commands:
bash has C-x C-e and the `fc` buildin, other shells have equivalents.
https://www.gnu.org/software/bash/manual/bash.html#index-edi...
I have extensively used awk and it's lacking when mid size problems become larger projects.
I also have used perl quite a bit, and if you love the "sigil" you can become very, very happy with perl. I personally never go warm with sigil, I have developed sigil-itis, so to speak.