> From: Uri Guttman [mailto:uri@sysarch.com] > Sent: Wednesday, August 04, 1999 21:39 > To: jdporter@min.net > Cc: fwp@technofile.org > Subject: Re: [FWP] Perl Card Games > > >>>>> "JP" == John Porter <jdporter@min.net> writes: > > JP> @a = (undef) x 5; # any value; it will get overwritten. > JP> for ( @a ) { > JP> @$_ = (....); > JP> } > > JP> Now, as for the loop problem: why is the semantics of for as > JP> a statement modifier so different from the normal for? > > i still don't get what you expect @$_ to be? explain it in english if > you can. it looks like a symref. if it is meant to be an array ref then > you should initialize @a with ([]) x 5. and i don't think there is any > difference in the semantics of a for loop vs. statement modifier in this > case. you just never had a proper array ref in $_. I haven't read everything in this discussion yet. (Who could and get anything else done? :-) However... As someone pointed out already, that produces five copies of one reference. More likely: my @a = map [] => 1 .. 5; ... -- Larry Rosler Hewlett-Packard Laboratories http://www.hpl.hp.com/personal/Larry_Rosler/ lr@hpl.hp.com ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe