Grandfather,
Like Fletch asked, why separate the lines from the widget? I combined the code and ran it, and it worked fine without splitting the lines.
#!/usr/bin/perl -w
use strict;
use Tk;
my $maincolor='red';
my $mw = MainWindow->new;
$mw->minsize(qw(250 200)); #x y
$mw->configure(-title=>'PROGRAM', -background=>$maincolor);
my $frame_1=$mw->Frame(-borderwidth => 3, -background => $maincolor)->
+pack( -side=>'top', -fill=>'x');
$frame_1->Label(-text => 'Scroll', -background=>'yellow',)->pack(-side
+ =>'left');
my $scroll=$mw->Scrolled("Text", -scrollbars => 'e', -width => 10, -he
+ight => 10,)->pack;
my $frame_2=$mw->Frame(-borderwidth => 3, -background => $maincolor)->
+pack( -side=>'top', -fill=>'x');
$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;
my $lines = $scroll->Contents();
print $lines;
}
jdtoronto