sub mymain() { # This would normally be real text my(@old_x_view) = $text->xview; $counter++; print "this is a very long line we need a scrollbar on the x axis........ this is a very long line we need a scrollbar on the x axis........ this is a very long line we need a scrollbar on the x axis........ well the number is current = " . $counter . " \n"; $text->xview(moveto => $old_x_view[0]); }