sub attempt_closure_after_successful_candidate_file_open (&closure, @fileList) { foreach my $file (@fileList) { my $f is post { close } = try { open $file or die; CATCH { next } } &closure($f); return; } throw Exception "Can't open any file.", debug => @fileList . " tried."; } #### my $foo = BEGIN{ compute_cont() } + $foobar;