A hash is the best solution in general. Perhaps in your situation you'd be better served by scrapping the arrays and just going with the hashes. Or perhaps there's something different about your situation that you're not saying, but in general hashes are exactly what to use for the situation you describe. Nicholas.G.Thornton@directory.reed.edu (Nicholas G. Thornton) wrote: >say we have an array like... > @weekdays = (mon, tues, wed, thurs, fri, sat, sun); >....and we do $weekdays[0] we get "mon", no problems. But is there a >simple way to go backwards from "mon" to get "0" without testing every >value in the array? The best I've come up with so far is to have a >hash... > %weekdays = (mon => 0, tues => 1, wed => 2, thurs => 3, fri => 4, sat > => 5, sun => 6); >.... and do $weekdays{mon} to get "0". But for what I'm doing I'd like >not to have an inverse hash for all the arrays. > >le meas, >--Nick ># ===== Want to unsubscribe from this list? # ===== Send mail with body >"unsubscribe" to macperl-request@macperl.org > ------------------- ------------------- Ken Williams Last Bastion of Euclidity ken@forum.swarthmore.edu The Math Forum # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org