Perl Skewer
Today a colleague posted the following "confession":
I prepare vegetable skewers by starting with a mushroom head and a slice of bell pepper as open parenthesis, and than make sure that they match up at the other end.
Turns out you can do that in Perl, too:
$~ perl -Mutf8 -E 'my @skewer = qw 🍄 some delicious vegs 🍄; say $skewer[1]'
delicious
Yay!
This uses the qw
operator (short for "quote words") to build a list of words. Usually you would use qw
like this:
my @skewer = qw(some delicious vegs);
Or use some other parenthesises:
my @skewer = qw[some delicious vegs];
my @skewer = qw{some delicious vegs};
But if you add a space after qw
you can use any character instead of parenthesis-y ones:
my @skewer = qw ;some delicious vegs;;
This sometimes makes sense when whatever content your quoting contains parenthesis.
And it allows for fun mushroom skewers!
Edits:
Fixed translation error (paprika vs bell pepper) reported by tyrminal