Very cool. If I had only know that before, I wouldn't have had to write it :p
Also, can reading from a file handle return non-scalars?
-jackdied | [reply] |
Reading from a file handle returns either a scalar, if you're doing something like "$x = <FH>", or a list, if you're doing something like "@x = <FH>". These are the only 2 contexts (scalar context and list context) available in Perl (well, there's also a void context, if you're really picky).
But I don't think that's what you're asking. If you meant "can reading from a file handle return non-strings", the answer is also positive. Your READLINE method can return any scalars it likes. A list reference is just a scalar, so it could return a list reference in scalar context and a list of list references in list context. Just like any Perl function, really.
| [reply] [d/l] [select] |