my $open; # variable with file scope # The sub open : sub open_file {$open = $mw->getOpenFile( # no my here! ...