develooper Front page | perl.perl6.language | Postings from May 2001

Re: Apoc2 - <STDIN> concerns

From:
Dave Storrs
Date:
May 10, 2001 08:30
Subject:
Re: Apoc2 - <STDIN> concerns
Message ID:
Pine.BSF.4.21.0105100808430.91822-100000@megazone23.bigpanda.com


On Tue, 8 May 2001, Larry Wall wrote:
 
> In this view, * and < could just be two different kinds of "expandable" flags.
> But I'm uncomfortable with that, because I'd like to be able to say
> 
>     lazy_sub(<$STDIN, <$STDIN, <$STDIN, <$STDIN)
> 
> to feed four lines to lazy_sub without defeating the prototype, er,
> signature checking.  Maybe you have to us *<$STDIN to do both.  But that
> would probably say to slurp the whole rest of the file.

	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



Dave




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About