$text is in the module code for Win32/ShellQuote.pm. However looking at that code isn't going to resolve the problem. The way to track this issue down is to perform a binary search. Get rid of half the code. If the bug goes away it was in the half of the code you removed. If the bug remains it is in the half you retained. Halve the chunk of code manifesting the bug then rinse and repeat.
By definition the bug is something to do with your context when you run the script. We don't have your context so we can't debug for you. Either strip your example down to something we can run that exhibits the problem, or do the debugging yourself.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond