Gary Efron <ge*****@cox.net> wrote in message news:<VbO%b.3085$506.900@fed1read05>...
I can write and print to the terminal, but do not know how to write or
print to the printer. The examples I saw, did not work. Please either
tell me or direct me to some documentation.
Open a filehandle and write to that handle. If your printer is on the
network, do something like:
use IO::Socket;
my $remote_host = '192.168.1.49';
my $remote_port = '9100';
my $socket = IO::Socket::INET->new(
PeerAddr => $remote_host,
PeerPort => $remote_port,
Proto => 'tcp',
Type => SOCK_STREAM,
) || die "Couldn't connect to $remote_host\:$remote_port : $@\n";
while ( my $psdata = <DATA> ) { print $socket $psdata; }