in reply to unix write command through system

Unix write command takes STDIN, and sends out the message.

Better use one of the IPC solutions. You can use open3 or other IPC solutions documented in perlipc. The benefit of using open3 is that it enables you to read from STDERR, and some implementation of write command does produce useful errors through STDERR.

The following code is not tested, and is only used to demo the idea:

my $pid = open3(\*WRITER, \*READER, \*READER, "write", "receiver", "te +rminal"); #receiver's name is passed as a parameter to open3 call print WRITER $ +msg; #read STDERR for possible error msg's waitpid($pid, 1);

It is important to waitpid on your child process, otherwise zombies could be created.

write command can take one or two parameters, and the second one identifies the terminal, as one user can logon to multiple terminals. In case the user logon to multiple terminals, and you don't provide terminal name, the system would pick the one with the shortest idle time.