foreach my $file ( @files ) { my $fh; if ( $file =~ m{ \A (.*) : (.*) \z }xms ) { open $fh, '-|', 'ssh', $1, 'tail', '-n' => '0', '-f', $2; } else { open $fh, '-|', 'tail', '-n' => '0', '-f', $file; } $fh->blocking(0); Event->io( fd => $fh, cb => \&data ); }