< QUOTE LARRY >
Dave Storrs writes:
:       You know, it would be really cool if you specify the number of
: lines you wanted like so:
: 
:       <$STDIN                 # One line
:       *<$STDIN                # All available lines
:       *4<$STDIN               # Next 4 lines
: 
: Or even:
: 
:       *$num_lines<$STDIN      # Numifies $num_lines, gets that many
:       *int rand(6)<$STDIN     # Gets 0-5 lines
:       *&mySub($bar)<$STDIN    # mySub returns num, gets that many

Given appropriate overloading on the iterator object:

    @foo = $STDIN * 4;

Larry

< END QUOTE>



Actually, on more reflection, I'm going to side with the people who say
that the single-character version is not an improvement, and that we
should stick with <>.  Also, I'd prefer to use the 'x' operator for
specifying multiples:

        @foo = <$STDIN> x 4;
        @foo = <$STDIN> x &mySub;
        
The parallel with "$foo = 'bar'x2;", where bar is simply repeated twice,
is obvious:  '<$STDIN' iterates the, uh, iterator, and repeating that
operation iterates it multiple times.  It even reads nicely "Fetch a line
from STDIN times four" (or, more idiomatically, "...four times").

                        Dave

Reply via email to