in reply to Get Position of Element in an array
DB<1> @input=('a','b','c','d'); DB<2> %pos= map { $_=>$i++ } @input DB<3> print $pos{a} 0 DB<4> print $pos{d} 3
... so what if elements aren't unique?
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get Position of Element in an array
by LanX (Saint) on Nov 16, 2010 at 19:26 UTC |