Re: Searching a sorted array of strings



one man army wrote:
In article <1141164998.245194.57600@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"Paul Lalli" <mritty@xxxxxxxxx> wrote:

No. No one is telling you you have to redefine your entire structure.
You are perfectly able to use your existing structure.

@CA_Cities = ('San Francisco', 'Los Angeles', 'Anaheim', ); #etc - as
defined before
%CA2 = map {$_ => 1} @CA_Cities;

_that_ looks useful

It is. Shocking, I know, that the answer given in the FAQ might be
useful. Again, quoting from the FAQ:
===========================
That being said, there are several ways to approach this. If you are
going to make this query many times over arbitrary string values, the
fastest way is probably to invert the original array and maintain a
hash whose keys are the first array's values.

@blues = qw/azure cerulean teal turquoise lapis-lazuli/;
%is_blue = ();
for (@blues) { $is_blue{$_} = 1 }
==========================

Which is simply a different way of writing the same thing I did.

You're not getting this.

You're not getting me. I am not arrogant,

I'm sorry, but you are. Just because you don't realize it does not
make it so.

I said I was using the
language today, and here is something that works.

Yes, but it doesn't work as well as the existing solutions.

Whats arrogant about
that? Where did I say I was telling anybody to do it this way?

In your original post, in which you hoped someone would find and use
the code you had just written.

This is twiste..
I stood up for myself ny telling you RTFM was not such a big
contribution,

Really? Even after you just admitted that TFM was "useful"? This has
nothing to do with "standing up for oneself". This is about optimal
programming methods, and suggesting that people use sub-optimal
methods, because you either didn't find or didn't understand the FAQ.

for that you have to character assisinate? no way.

I have done no such thing.

Paul Lalli

.