[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Shuffling (was Re: [FWP] Perl Card Games)



On Thu, Aug 05, 1999 at 01:15:03PM -0400, Amir Karger wrote:
> On Thu, Aug 05, 1999 at 04:16:52PM +0000, Bennett Todd wrote:
> > So Fisher-Yates looks like
> > 
> > 	for (my $i = @_; $i > 0; $i--) {
> > 		@_[$i, $_] = @_[$_, $i] for rand $i+1;
> > 	}
> 
> Is this use of "for" as a simple statement documented? Also, I'm not sure it
> works for me.
> 

That's not a statement, but a statement modifier, just like the statement
modifier forms of if, unless, and while, except that statement modifier
for/foreach was not added until perl5.005.

Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe