quote qqww

Documentation for quote qqww, assembled from the following types:

language documentation Quoting Constructs

From Quoting Constructs

(Quoting Constructs) quote qqww

The qqw form of word quoting will treat quote characters literally, leaving them in the resulting words:

my $a = 42say qqw{"$a b" c}.perl;  # OUTPUT: «("\"42", "b\"", "c")␤» 

Thus, if you wish to preserve quoted sub-strings as single items in the resulting words you need to use the qqww variant:

my $a = 42say qqww{"$a b" c}.perl# OUTPUT: «("42 b", "c")␤» 

Quote protection happens before interpolation, and interpolation happens before word splitting, so quotes coming from inside interpolated variables are just literal quote characters:

my $a = "1 2";
say qqww{"$a$a}.perl# OUTPUT: «("1 2", "1", "2")␤» 
my $b = "\"2 3\"";
say qqww{"$b$b}.perl# OUTPUT: «("1 \"2 3\"", "1", "\"2", "3\"")␤»