#!/usr/bin/perl use Tk; sub go { local $SIG{CHLD} = 'IGNORE'; # don't wait for child # exit status. avoids # zombies. die "fork failed: $!" unless defined($pid = fork); return if $pid; exec("xterm"); warn "exec failed: $!"; CORE::exit(1); } $m = tkinit; $m->Button(-text=>"Foo",-command=>sub{print"Foo\n"})->pack; $m->Button(-text=>"Go",-command=>\&go)->pack; MainLoop;