Perl + shell = Sherl

Backticks. Technically speaking, what I’m advocating is probably bad form and frowned upon by real computer scientists, but I love system calls from within Perl scripts. Why would I write several lines of Perl to query what’s in a directory or write a temporary file when I could just use bash shell scripting commands wrapped in backticks?

## Use sed from within Perl to edit a file
`sed -i 's/something/$somethingelse/g' somefile.txt`;
## Read a list of chromosomes directly into an array
my @chromos = `cat /home/cwardell/b37/human_g1k_v37.fasta.fai | awk '{print \$1}' `;

If we consider the ends to be justified by the means (let ends = “getting as much work done in the most time-efficient way possible” and means = “a bit of hackery”), I see no real problem with it. This is a great deal of my code ends up containing a great deal of backticks. In case you’re not familiar with backticks, you can find them in the top-left of your keyboard, nestled between the Esc, Tab and 1 keys. Officially a backtick is termed the “grave accent” and is not to be confused with the apostrophe, which will do nothing for your code except throw errors, as your enclosed command will be interpreted as a string.

Bearing in mind that Perl is already an unforgivably unattractive language and you’re doing it no great aesthetic harm by throwing in some shell scripting, I therefore name this ugly mongrel mix of two ugly languages “Sherl” and I’ll keep using it because I sometimes value function over form, at least until I’m visualising data. I’m also trusting that your code is so comment-heavy that you’ll understand the what, how and why of your Sherl code.  You do obsessively comment your code, right?