my ($prch,$pid) = @_; #### sub component_window { my ($prch,$pid) = @_; ... my $tail = Tk::IO->new( -linecommand => sub { tail_lines($prch, $_[0]) }); ... } sub tail_lines { my ($proc,$text) = @_; ... } #### sub component_window { my ($prch,$pid,$text)=@_; ... #### ... my $tail = Tk::IO->new( -linecommand => sub { tail_lines($prch, $text) }); ... }