I propose generalizing this to also allow open our $foo, ... (to explicitly open a global filehandle; remember TIMTOWTDI) and open state $foo, ...
use warnings;
use strict;
use feature 'state';
sub xyz {
open state $foo, '<', '/tmp/foo' or die $!;
chomp( my $bar = <$foo> );
close $foo;
return $bar;
}
open our $foo, '>', '/tmp/foo' or die $!;
print $foo "Hello\n";
close $foo;
use Test::More tests=>1;
is xyz(), "Hello"; # => PASS
the result will be a disaster reminiscent of Fahrenheit 451.
A variation on Godwin's law?