... $frame_2->Button( -text => 'Print', -width=>7, -command=>\&doPrint )->pack(-side =>'bottom'); MainLoop; sub doPrint { my @lines = split /\n/, $scroll->Contents (); print join "\n", @lines; }