#! perl -slw use strict; use threads; use threads::shared; use Thread::Queue; my $Qin = new Thread::Queue; my $done :shared = 0; async{ open my $fh1, '<', "firewall.log" or die "FWLog : $!"; ( local $_ = <$fh1> and $Qin->enqueue( "F1:$_") ) or Win32::Sleep 10 until $done; close $fh1; }; async{ open my $fh2, '<', "modem.log" or die "Modemlog : $!"; ( local $_ = <$fh2> and $Qin->enqueue( "F2:$_" ) ) or Win32::Sleep 10 until $done; close $fh2; }; while( my $input = $Qin->dequeue() ) { chomp $input; my( $src, $txt ) = split ':', $input, 2; if( $src eq 'F1' ) { print "Firewall: '$txt'"; } else { print "Modem : '$txt'"; } }