use warnings; use strict; use Tk; my $mw = MainWindow->new (-title => "editor"); my $text = $mw->Scrolled ('Text', -font => 'normal', -wrap => 'word', -scrollbars => 'e',); $text->pack (); $mw->Button (-text => "open file", -command => \&openFile)->pack (); MainLoop (); sub openFile { my @filetypes = ( ['Text', '.txt', 'TEXT'], ['Text', '.txt', 'TEXT'], ); my $currentFile = $text->getOpenFile (-defaultextension => '.txt', -filetypes => \@filetypes); } #### use Storable; # Load persistent stuff my $persistRef = retrieve ('config') if -e 'config'; # Use stuff my $text = $persistRef->{text} || ''; # ... $persistRef->{text} = $text; # Save stuff store $persistRef, 'config';