First of all, don't use multiple MainWindows. It's certainly possible, but parts of Tk aren't reliable when used with multiple MainWindows. Your best bet is to use Toplevels. You create one MainWindow and then create the other windows by making Toplevels from the MainWindow
my $win = $mw->Toplevel(-title => 'ererree');
If you don't want to have one and only one MainWindow (remember that closing a MainWindow exits your program), you can use only Toplevels and call $mw->withdraw immediately after creating the MainWindow. Your MainWindow will then be invisible and you'll only have Toplevels, which can be closed without requring the program to end.
As far as your actual question, try $win->focus, where $win is the name of the window you want to bring to the front.
The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows.
- Frank Zappa