Jaws was never my scene and I don't like Star Wars

Perl 5 and qqw{} - Quote word with interpolation

Perl 5 has these handy quote operators to save you time, like q{} and qq{} to quote strings without and with interpolation, e.g.

0> q{"I don't have to escape quotes!"}
$res[1] = ""I don't have to escape quotes!""

It also has qw{} to create lists from quoted words. This does not interpolate variables:

1> my $message = "This is the commit message"
$res[1] = "This is the commit message"
2> qw{ git commit -m $message }
$res[2] = [
    [0] "git",
    [1] "commit",
    [2] "-m",
    [3] "$message"

So what if I want interpolation in my quoted word operator? qqw{}, right? Well no, but Perl 6 has qqw{}:

> my $message = "This is the commit message"
This is the commit message
> join "\n", qqw{ git commit -m $message }

Hmmm, not quite what I need. Looks like what I want is qqww{}

> join "\n", qqww{ git commit -m "$message" }
This is the commit message

Perfect! Except I'm working with Perl 5. Enter Quote::Code which offers code interpolation. Variables are code, so:

3> use Quote::Code
4> qcw{ git commit -m {$message} }
$res[2] = [
    [0] "git",
    [1] "commit",
    [2] "-m",
    [3] "This is the commit message"


Shout out to freenode #perl regulars pink_mist for mentioning Quote::Code and mauke for building it in the first place!

by fuzzix on Fri, 16 Nov 2018 09:08.


Sat, 13 Jul 2019 08:27

6 Pack - Culturelle Daily Probiotic Formula, Digestive Health Capsules 30 ea

<a href=http://pegasbaby.com/com/shop/view/159216/>Women's Bright Fit and Flare Mini Dress</a>


Sun, 14 Jul 2019 01:27

Ciao! fuzzix.org

We present

Sending your message through the Contact us form which can be found on the sites in the Communication partition. Feedback forms are filled in by our program and the captcha is solved. The superiority of this method is that messages sent through feedback forms are whitelisted. This method improve the chances that your message will be open.

Our database contains more than 25 million sites around the world to which we can send your message.

The cost of one million messages 49 USD

FREE TEST mailing of 50,000 messages to any country of your choice.

This message is automatically generated to use our contacts for communication.

Contact us.
Telegram - @FeedbackFormEU
Skype FeedbackForm2019
WhatsApp - +44 7598 509161
Email - FeedbackForm@make-success.com

Comment on this post

Text only, no HTML, * denotes a required field.

Name *
Email Address *
Mystery box, leave it alone!