use Tk; my $mw = new MainWindow(); my $content; my $text = $mw->Text()->pack(); $text->Insert( "junk1.dat\njunk2.dat\njunk3.dat\n" ); my $ok = $mw->Button( -text => "View in Notepad", -command => sub{ my $file = $text->getSelected; system 1, "notepad $file"; } )->pack(); MainLoop;