my $text; # outside of the block so it's in scope after we leave the block { local $/; open (PAGE, $filename) || die "Can't open $filename: $!"; $text = ; close (PAGE) || die "Can't close $filename: $!"; }