sub tail_lines { my ($proc,$text) = @_; print "tail_lines $text" if $debug; push @{$proc->{tailbuf}},$text; } sub check_log { my $this = shift; return unless exists $this->{log}; # ... other code here to do with log files if (exists $this->{tailbuf}) { my $outstr = ''; $outstr .= shift @{$this->{tailbuf}} while @{$this->{tailbuf}}; $this->{tailwin}->insert('end' => $outstr); $this->{tailwin}->see('end'); } }