in reply to Generate unique file handles

local $fh erases the content of $fh. And even if it didn't, open doesn't takea variable name for its first argument (just a variable).

You can simply use

open(my $fh, '<', 'test.out')

Open returns a new anonymous file handle in $fh every time.