in reply to perl/Tk error

Try getting rid of the quotes around the callback, like this
my $but=$mw->Button(-text=>"press",-command=>\&newwindow)->pack();