On Thursday, April 18, 2002, at 06:05 , Felix Geerinckx wrote:
> on Thu, 18 Apr 2002 12:56:43 GMT, [EMAIL PROTECTED] (Richard Noel Fell) > wrote: > >> However, I do not understand your >> comments about the return value of map. Does not map return a >> reference to an anonymous arrar, not a hash? > > 'map' returns a *list*. hence map {[ 'cascade', '~'.$_]} @sub_directories; as the last line of the sub should have returned a 'list' back to the caller just as the sub foo { qw/ 1 2 3 4 5 6 7 8 9 / } ; would return a 'list' ??? or should he have coerced it foist: @array = map {[ 'cascade', '~'.$_]} @sub_directories; @array ; # our default return } # end of this function ( ????? ) > This list can be coerced into an array or into a > hash (if it has an even number of elements). It's the same as literal > list assigment; you can both do: > > @array = (1,2,3,4); > %hash = (1,2,3,4); > > Also > > @array = (1,2,3); > > But not (gives an 'Odd number of elements in hash assignment' error): > > %hash = (1,2,3); > good Point! I guess I have always seen map, when used with has in the classic form %hash = map { doFooFunk($_) => $_ } @array; and have never seen it in the form of @chars = map(chr, @nums); so had never paused to 'think it through'. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]