# insert widget code here open (LOG, "tail -f log.log|") || die "Nope : $!"; $mw->fileevent(\*LOG, 'readable', \&insert_lines); MainLoop(); sub insert_lines { my $line; if(defined($line = )){ if( $line =~ /(CRITICAL|MAJOR)/){ $text->insert('end',$line,$1); } else { $text->insert('end',$line); } }else{ $mw->fileevent(\*LOG, 'readable',''); } }