On the macosx@perl mailing list, it was asked how to quit an app. Many people suggested AppleScript. But, as I am fond of saying, I hate AppleScript. So:
#!/usr/bin/perl -w
use POSIX 'SIGTERM';
use Mac::Processes;
while (my($psn, $psi) = each %Process) {
next unless $psi->processName eq 'Mozilla';
kill SIGTERM, GetProcessPID($psn);
last;
}