in reply to Determining indirect filehandles
When $fh is a filehandle opened on something like a pipe, on which one cannot seek, the seek fails so it seems as if $fh is not a filehandle. $! holds the reason ("Illegal seek"), and $@ is empty.
If $fh holds a number or a string, the seek fails, but does not die, so again $! holds the reason ("Bad file number") and $@ is empty.
If $fh holds a reference to a something other than a glob or filehandle object, the seek does die, and $@ holds "Not a GLOB reference...", as intended.
I'm not sure how one would distinguish easily between the first two cases, other than by examining $!, which wouldn't be portable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Determining indirect filehandles
by Masem (Monsignor) on Jan 23, 2002 at 19:44 UTC |