#!/usr/bin/perl use strict; use warnings; # input device my $input = "/dev/dsp1"; # open filehandler open(my $fh, '<', $input) or die("ERROR open $input ($!)\n"); binmode($fh); while(1) { my $buffer; # read one byte read($fh, $buffer, 1); if(defined($buffer)) { # ignore } else { print "nothing to collect\n"; } } close($fh);