Rob, James, James Edward Gray II wrote:
>On Feb 10, 2004, at 2:39 PM, Jan Eden wrote: >> Rob, I read the perlfaq paragraph you mentioned and found that it >> proposes a solution which does not make use of 'exists': > >What's wrong with exists()? I like exists() and you're going to hurt >it's feelings. :) > It has six characters which can be left out to minimize typing. >You could also use map() I guess, if you don't consider that a loop: > >@[EMAIL PROTECTED] = map { 1 } 0..$#blues; > For some irrational reason, I consider this more of a loop than your first/Rob's solution below. Rob Dixon wrote: >It's not for me to rewrite the docs (or perhaps it is?) but > >for (@blues) { $is_blue{$_} = 1 } > >does the same thing as > >@[EMAIL PROTECTED] = (1) x @blues; > I finally came up with an idea of my own, just when I got up this morning: @[EMAIL PROTECTED] = 1 .. @blues; This way each of the hash keys gets a value different from zero, so >if ($is_blue{$_}) still works. Now it might be hard to determine which of these two is faster. There's really more than one way to do it. Thanks to you all, for patience and friendliness, Jan -- These are my principles and if you don't like them... well, I have others. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>