On Mon, 2004-05-24 at 14:09, Jose Alves de Castro wrote: > On Mon, 2004-05-24 at 13:46, [EMAIL PROTECTED] wrote: > > sub xpto { > > my %a = map {$_ => undef} (@_); > > return \%a; > > } > > > > or > > > > sub xpto { > > return {map {$_ => undef} (@_)}; > > } > > > > > > I'm using this code but shall exist someting clearner without map. Can you > > help me? > > If what you want is to clean that, try > > sub xpto { > map {$_ => undef} @_ > }
sub xpto { { map {$_ => undef} @_ } } > That'll do the trick > > If you want to get rid of the map, try this instead: > > sub xpto { > my %b; > @[EMAIL PROTECTED] = (); > %b > } sub xpto { my %b; @[EMAIL PROTECTED] = (); \%b } Oops... :-) I misread your mail and didn't notice you were looking for a reference; hence, this update :-) > > Thanks > > HTH > > jac > > -- > Josà Alves de Castro <[EMAIL PROTECTED]> > Telbit - Tecnologias de InformaÃÃo -- Josà Alves de Castro <[EMAIL PROTECTED]> Telbit - Tecnologias de InformaÃÃo -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>