#!/usr/bin/perl use strict; use warnings; use Tk; my $text; my $mw = tkinit; my $textw = $mw->Text()->pack; $mw->Button( -command => \&getfilename, -text => 'oeffnen' )->pack; $mw->Button( -command => \&getoutput, -text => 'speichern' )->pack; MainLoop; sub getfilename{ my $file = $mw->getOpenFile; if( open my $fh, '<', $file ){ local $/; $text = <$fh>; } $textw->insert('end', $text); } sub getoutput{ my $file = $mw->getSaveFile; if( open my $fh, '>', $file ){ $text = $textw->get('1.0','end'); print $fh $text; close $fh; } }