in reply to Re: smartmatch and index
in thread smartmatch and index

hopefully we're not arguing semantics...but i think being able to get the index (array 'position') based on the result of a positive smartmatch is very useful. knowing that ( "foo" ~~ @big_array ) is true is helpful (and we rejoice in how fast it is). in some cases knowing that "foo" is at index 346456 may be really really helpful. i realize that "foo" could appear repeatedly and in that case the map example is a good solution. it would be nice if the smartmatch function could be a bit more "telling".

Replies are listed 'Best First'.
Re^3: smartmatch and index
by ikegami (Patriarch) on Oct 13, 2010 at 15:58 UTC

    i think being able to get the index (array 'position') based on the result of a positive smartmatch is very useful.

    Indeed, and I showed you how to do it.

    it would be nice if the smartmatch function could be a bit more "telling".

    Smart match has nothing to do with arrays. It can't return indexes when most match rules don't even involve indexes.