in reply to Pl/Tk

Here's a minimal example that shows one way to do it (probably the simplest way):
#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new(); my $txtvar; # have a separate scalar for each Entry widget $mw->Entry(-textvariable=>\$txtvar # this is the trick )->pack(); $mw->Button(-text=>"Print & Clear", -command=>sub{print $txtvar,$/; $txtvar=""} )->pack(); MainLoop;
If the Entry widget is configured to have a "-textvariable" (a reference to a scalar), then the callback function on a button simply needs to reset that variable to an empty string. Naturally, if you have a lot of Entry widgets, it may be handy for their textvariables to be elements of an array or hash, in which case you give each Entry a reference to an element of the array or hash:
my %strings = qw/first one second two third three/; for my $name ( sort keys %strings ) { $mw->Label(-text => $name)->pack(); $mw->Entry(-textvariable => \$strings{$name})->pack(); } $mw->Button(-text=>"Print&Clear", -command=>sub{ for (sort keys %strings) { print "$_=$strings{$_} "; $strings{$_} = ""; } print $/; } )->pack();