my $height = $main->reqheight; # or $main->height $main->geometry ('500x' . $height);