my $blah = 'foo.Q'; print qq{gcc $blah -o @{[ substr $blah, 0, -2 ]} and many more }; __END__ gcc foo.Q -o foo and many more