sending multiple arguments to shell command with defun and interactive

"John Bullock" <[email protected]> Wed, 12 Oct 2005 06:58:04 -0700
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Hello,

        I often want to process a block of text with a Perl script, and then
have the original block replaced by the output from the Perl script.  I think
this should be very easy to do in XEmacs.  Indeed, I've almost done it.  But
not quite.
        This is the not-quite-working function I have in custom.el:

                (defun perlhello (old new)
                  (interactive)
                  (shell-command-on-region (point)
                      (mark) "perl c:/perl/misc/perlhello.pl" nil t))

The problem is simple: I don't know how to pass arguments "old" and "new" to
perlhello.pl.  I am sure that the fix has something to do with
(interactive) -- but more than that, I don't know.

I'd like to execute this command just by highlighting a block of text and
typing "M-x perlhello old new", where "old" and "new" are just strings that I
will pass to the script.

Can you help me?  I've tried working through the XEmacs manual, but I haven't
had much success.  I'm running XEmacs 21.4, mostly on Windows.

Many thanks,
--John