#! /usr/bin/perl use strict; use warnings; use Tk; use Tk::TextUndo; my $mw = MainWindow->new(); my $sc = $mw->Scrolled('Text', -height => '1', -width => '10', -scrollbars => 'osoe', )->pack(); $mw->Button(-text => 'del',-command => \&deleter)->pack(); $sc->insert('end','Test'); MainLoop; sub deleter{ my $text = $sc->get('1.0','end'); print $text,"\n"; }