#!/usr/bin/perl use warnings; use strict; use IO::Select; my $timeout = 1; my $s = IO::Select->new(); $s->add( \*STDIN ); while (1) { if ( my @ready = $s->can_read($timeout) ) { # we got input for my $fh (@ready) { my $input; sysread( $fh, $input, 1024); #do some processing, for example syswrite(STDOUT, "processed: $input"); } } }