Perhaps using an iterator might be a solution. Create an Iterator::Simple iterator object out of the original file handle, pull the first couple of lines from the original file handle to validate file type, and then use the iterator as the file handle passed to the actual processing code. IIRC, the iterator can behave like a standard file handle. You will need to manage the storage of the first bit of text that you check on, but the coding is pretty simple.
--MidLifeXis
In reply to Re: peek at STDIN, to determine data type and then pass STDIN to a parser
by MidLifeXis
in thread peek at STDIN, to determine data type and then pass STDIN to a parser
by aral
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |