James, Rob, Japhy,
I am impressed, really. Thank you!
Me too. We haven't scared you off yet. :) Impressive.
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. :)
@blues = qw/azure cerulean teal turquoise lapis-lazuli/; %is_blue = (); for (@blues) { $is_blue{$_} = 1 }
Now, I had the idea to combine your hash slice with this solution doing:
@blues = qw/azure cerulean teal turquoise lapis-lazuli/; @[EMAIL PROTECTED] = 1;
@[EMAIL PROTECTED] = (1) x scalar @blues;
But since I have only a single number on the right side of the assignment function, only one hash element gets 1. Is there a way to automatically assign "1" to all elements with the hash slice notation (i.e. without using a loop)?
You could also use map() I guess, if you don't consider that a loop:
@[EMAIL PROTECTED] = map { 1 } 0..$#blues;
I promise to drop the subject after this question. ;)
I don't mind. I'm not even Rob. ;)
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>