From: dblack@... Date: 2003-01-10T03:39:00+09:00 Subject: Re: so it seems there is no way to pass argument lists? Hi -- On Fri, 10 Jan 2003, Tom Sawyer wrote: > so it seems there is no way to pass argument lists? > > def throwem > return *[1, 2, 3] > end > > def catchem(*args) > return args.length > end > > puts catchem throwem #--> 1 > > the astrisk(*) amounts to nothing. :-( There's nothing you can't do, by way of passing arrays around; you just have to process them according to what you've asked Ruby to do. In this case, if you have: def catchem(*args) then you have to get at args[0] to see the first argument -- which, in this case, is itself an array. (It's not that the * in throwem does nothing; it's that the way Ruby passes multiple return values is by packaging them into an array.) def throwem return 1,2,3 end def catchem(*args) args[0].length end puts catchem(throwem) # 3 David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav