http://www.perlmonks.org?node_id=918897

It's the weekend. Time to get your head out of the production-level code. But not too far - we'd go off-topic. So let's instead think about some of the worst ways to do things.

I don't mean things like `rm $file`;. I'm thinking more along the lines of a daily wtf, but for people who don't automatically think that "perl code" == "line noise". For example:

sub remove_newlines { my $string = shift; my $clean_string = `echo -n $string`; return $clean_string; }
This isn't merely chomp - this is super-chomp. Whether you have one or many new lines at the end of your string, this will clear 'em all out. If you're not shaking your head in disappointment over that code, you're probably not realising that s/\n+$// does the same job - but faster, more reliably (no shell metacharacters to worry about!) and is far more portable.

Sit back, crack open your favourite beverage, share code you'd be embarrassed to check in to source control or upload to CPAN, and enjoy your weekend. :-)