!#/usr/bin/perl -w use strict; my ($victim, $message) = ("joe", "bloop"); # open an output pipe to the external program open SMB, "| smbclient -M $victim"; # print on the pipe's handle print SMB $message; # close the handle, which implicitly sends an EOF close SMB;