I think a more correct solution (and this isn't something you or I really need to worry about, but the author), might be to do a test against $fh to see if it
pointing to STDOUT, and if so, ignore the seek entirely. I can't think of any cases off the top of my head where a failed seek would be a bad thing in this place, so it might be perfectly OK to simply disregard the return value of this function and let it fail silently if it needs to.