#!/usr/bin/perl use strict; # WARNING: will probably lock up your X-server my $data; my $fd; my $buf; use POSIX; $fd = POSIX::open("/dev/mouse", &POSIX::O_RDONLY) || die ($!); while($data = POSIX::read($fd, $buf, 1)) { print "READ $data Bytes: " . join("", map(sprintf("%x",ord($_)), split(//, $buf))) . "\n"; }