In the example there, $fh is the filehandle you want to read from. You should open my $fh, '<', "somefile.txt" or die $!; somewhere earlier in the program.
PS: Simply saying that you added my $fh; doesn't help. You need to show the code, or the problem could be anything anywhere.