2 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/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; } }
2 Einträge, 1 Seite |