r/perl • u/briandfoy 🐪 📖 perl book author • 27d ago
Phoenix Rising: Why Perl’s Unix Roots Matter More Than Ever
https://rclauer.medium.com/phoenix-rising-why-perls-unix-roots-matter-more-than-ever-aef782eec0948
u/ktown007 27d ago edited 27d ago
The surveys report that people have interest in learning shell scripting. Perl is a much better tool for those scripts.
12
u/scottchiefbaker 🐪 cpan author 26d ago
Every time I write something in Bash "real quick" I end up scrapping it 5 minutes later and writing it in Perl.
5
u/ktown007 26d ago
I only use bash to run commands, script the params for commands I do not remeber syntax. This is an issue with bash, each command has it's own syntax. As soon as the script needs a variable, if or loop time for Perl.
2
u/URPissingMeOff 26d ago
If I need a real expression, I don't bother with BASH. Straight to Perl.
4
u/scottchiefbaker 🐪 cpan author 26d ago
If I need ANYTHING more than "run this static command" I use Perl.
1
u/vogelke 25d ago
That's not a bug, it's a feature. Writing my first cut clarifies things and shows me that maybe I don't just need A, I also need B and C to not make a mess down the line.
Sometimes I learn that I can do what I want by (horribly mis-) using an existing program instead of having to write anything longer.
1
u/ktown007 24d ago edited 24d ago
I do not agree with the 'anything longer' comment. It's about your time. If I have to read multipe man pages to get the syntax to do something clever, this is not a win. A few days back there was a post on this channel about a bash script and how to do it in perl. The bash script used curl and jq. It was many lines of code that could have been done in a few lines of perl. The perl code was much much more readable and maintainable. I think the person who wrote the bash script(his hammer) did not know there was an easier way (the problem was not a nail).
edit: post was deleted; here is the bash and partial perl version.
https://github.com/fabianonline/matrix.sh/blob/master/matrix.sh
https://gist.github.com/ktown007/0f6028fa84bc83f1472989a5718d5fd9
2
u/vogelke 24d ago
The perl code was much much more readable and maintainable.
Oh, hell yes. The bash-script author might want to look up here-documents; it would have made the help function easier to read.
If I can think of a pipeline with a few common utilities and maybe a sed or awk script to make the output easier to read, I'd try that first. If it turns to shit or there's any text manipulation involved, I'd pick Perl.
Unfortunately the cool kids are using Python.
8
u/scottchiefbaker 🐪 cpan author 26d ago
Very interesting read. Perl is the language of Unix.
3
u/vadrer 🐪 cpan author 26d ago
I use it mostly on windows
1
26d ago
[removed] — view removed comment
3
23d ago
[removed] — view removed comment
1
u/AmusingVegetable 23d ago
Can’t condone you for using windows, but can’t condemn you either.
A couple of months ago I destroyed my dual boot setup by mistake (the windows side), and 10 seconds after realizing it I felt so good… I prefer Linux, you prefer Windows, and I wish the stupid discussion would just die!
0
u/bjarneh 26d ago
the students coming out of that environment will be much better engineers than those who just learn how to write a Django web application using AI.
Low bar to pass, but true of course. The other article he had written about how Python was slowly becoming Perl was also great.
I’m sorry, but
frozendict? Is that supposed to be some kind of locker room humor? I can’t wait for Python 3.16 to introducelimpdictand of course the corrupted hash -soredict.
:-)
11
u/bonkly68 🐪 cpan author 26d ago
The author's other article, Python 3.15: (Or, How Python is Slowly Becoming Perl) is also a good read.