From: Hal Fulton Date: 2006-06-01T09:49:24+09:00 Subject: Re: A newbie question about scanf Ken Kam wrote: > Hal Fulton wrote: > >>These should all work: >> >> a, = scanf('%d') >> a,* = scanf('%d') # Prettier >> a = *scanf('%d') # Clearer? >> > > Hmmm... the * thing... > is it possible if you explain that in a bit more detail? Is that like > pointers in C? No... it's what David Alan Black calls the "unary unarray" operator, also called the "splat" operator. * on an array turns it into a simple list (sort of like removing the brackets). Actually... I think I misled you on the third example. I don't think it works. You'd still need more than one item on the left side if you used it. On the other side, it's different. x,* = array # means the same as x, = array # but with the * it looks better x gets assigned the first value. There's also: a = scanf('%d')[0] # or a = scanf('%d').first Hal