in reply to simple to describe I/O problem
See the documentation of IO::File: you need to initialize your $fh like so: my $fh=IO::File->new; before you use it.