use Tk; use File::Spec; $top = MainWindow->new(); my $menubar = $top->Menu(-type => 'menubar'); $top->configure(-menu => $menubar); my $filemenu = $menubar->cascade(-label => '~File', -tearoff => 0); $filemenu->command(-label => '~Report extract', -command => [\&report_extract], ); $filemenu->command(-label => 'E~xit', -command => [sub {exit}], ); print STDERR "there's a tiny window open, it's small but it's there\n"; MainLoop(); sub report_extract { my $tmpdir = File::Spec->tmpdir(); open (F, ">$tmpdir\\xx.csv") || die $!; print F "aaa,bbb,ccc\nddd,eee,fff\n"; close F; my $cmd = "start $tmpdir\\xx.csv"; print STDERR "running $cmd\n"; `$cmd`; }