Kill takes a list, so you could just do:
kill $signal, `ps -xawu | ...`;
or
kill $signal, @pids; # Once you have the pids
BUT,
I don't have option 'x' for my ps, so I don't know what it does, but if I'm killing a user, I'd use
Getopt::Std to accept a user argument and do a 'ps -u $username', and if I'm killing a certain command, I'd split the output and only kill pids where the command 'eq'uals the command I'm looking for, (or use -t for a tty etc). Grepping is too scary to me when killing processes.
And ++ for
turnstep's suggestion about using signal 15 for the default, and making it an option.