On 10/9/05, Uri Guttman <[EMAIL PROTECTED]> wrote: > >>>>> "IB" == Ingo Blechschmidt <[EMAIL PROTECTED]> writes: > IB> sub foo ($a) {...} > > works for me. but what about lists and arrays? > > my @z = ( 'a', 1 ) ; > foo( @z ) # $a = [ 'a', 1 ] ??
Yep. > my @z = ( a => 1 ) ; > foo( @z ) # $a = pair( a => 1 ) or does that need * too? $a = [ a => 1 ] You passed an array. The parameter gets an array. > same questions for lists (this shows a nested sub call) > > sub bar { return ( a => 1 ) } > foo( bar() ) # i would expect $a == ( a => 1 ) since there is > # no * > > foo( *bar() ) # i would expect $a == 1 Yeah, I think your expectations are correct. Basically, * takes whatever kind of object it is (array, hash, pair) and pretends that you wrote its contents literally into the argument list. Luke