> -----Original Message-----
> From: James Edward Gray II [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 24, 2004 3:00 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: get hash from array
>
>
> On May 24, 2004, at 7:46 AM, [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?
>
> I find map() to be the ideal solution. That's exactly what it's for.
>
> You could of course always roll your own loop.
>
> What exactly are you trying to fix?
>
> James
>
I had the idea that something like:
sub xpto {
my %a;
[EMAIL PROTECTED] = ();
return \%a;
}
should work.
Obviuslly this idea will be used in major subroutines.
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>