Sharan Basappa wrote:

On Thu, Mar 20, 2008 at 9:19 PM, Andrew Curry <[EMAIL PROTECTED]> wrote:
  %hash = map { $_ => 1 } @array;

             is just a funny way to write

                 %hash = ();
                 foreach $_ (@array) {
                     $hash{$_} = 1;


                 }

ok. thats what I wanted to confirm. I my crude code, I was doing
exactly that and was
wondering if there is some other way to make an entry without really
adding value.
Maybe, perl has to do it internally but will be much more optimal than the one
I am simply forcing a value of 1

my %hash;

@hash{ @array } = ();



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to