in reply to Re: Name Me! MixMatch?
in thread Name Me! MixMatch?

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

Replies are listed 'Best First'.
Re: Re: Re: Name Me! MixMatch?
by ariels (Curate) on Dec 19, 2001 at 14:38 UTC
    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.