In zsh, you can do:
set -o interactive_comments -o extendedglob
alias '@=:;# '
handle_@() {
local match
if [[ $1 = (#b)@\##[[:space:]]##([^[:space:]]##)[[:space:]]#(*) ]] $match
}
preexec_functions+=(handle_@)
And then prefix your commands with @ (has to make up the whole editing buffer, no foo; @ cmd nor foo | @ cmd, etc) for the first word after that to be taken as the command name, and the rest of the line to be passed as one single argument to that command:
$ @ echo asd'@123 # # qwe $x ``
asd'@123 # # qwe $x ``
That means that one argument can't start with whitespace nor contain newline characters though.
That works by aliasing @ with :;#, the : noop command (so preexec hooks be run) followed by the comment leader, so the rest of the line is parsed as a comment and discarded.
In the preexec hook, we split that unprocessed line (in $1) into the command and arg. Note the \## to allow # after @ in there to work around in bug in older versions of zsh (5.3 or older). Note that it won't work in 4.3.12 (from 2011) or older where the comment is not included in prexec()'s $1.
Of interest, zsh also has the quote-region and quote-line widgets (bound to Alt+" and Alt+' respectively by default in emacs mode) which can save the hassle of do proper quoting by yourself.
For, instance, you could do:
$ perl -e Ctrl+Space$x = 'whatever';...Alt+"
Where Ctrl+Space or Ctrl+@ (upon which terminals usually send a NUL character), sets the start of the region.
Upon Alt+", that would be transformed to:
perl -e '$x = '\''whatever'\'';...'
with the region now quoted. See also https://stackoverflow.com/q/5407916 for how to set the region (selection) with Shift + arrow/motion keys.