Perl is DWIM


I forgot about some batteries included with Perl.

In previous post Dew - running a command, lazily I described a loooong way to run a command using the shell:

system {'/bin/sh`} '/bin/sh`, `-c`, $command;

This is a complex way of invoking system (which also exists for exec, by the way), the simpler being:

system $command;

I never use this simpler form, because it passes $command to the shell for interpretation.



This is exactly what I was after in the first place, so this was that one time in which my muscle memory failed me, and my normal memory too (letting me forget that Perl is very do what I mean in nature).

I’m still leaving the implementation as-is anyway. It will be a clear sign for future me that this is exactly what I’m after, and not something that slipped for being in a hurry and left as a potential liability.

Of course I couldn’t figure this out all on my own, so I’m very, very happy (and lucky!) that wiser people take a look at my ramblings and gift me with their time to leave a feedback:

AP feedback

Stay safe!

Comments? Octodon, Twitter, GitHub, Reddit, or drop me a line!