... my $input = $mw->getOpenFile(); open FILE, ">$input" or die $!; FILE->autoflush(1); ... tie @lines, 'Tie::File', $input or die $!; ...