open MAILX,'|/bin/mailx -s "hello" john@work.com' or die $!; print MAILX 'Your message here'; close MAILX or die "mailx: $! $?";