in reply to hereto doc

You probably mean something like
my $string = join " -x exclude=$_" ,q(),@excludes;
You can use shell commands in back-quoted here doc, as in
print <<`EOF`; ls cd / ls EOF

Update: join used instead of for. Why do I always correct just a half of the problem? :)