<?xml version="1.0" encoding="windows-1252"?>
<node id="69545" title="Re: Re: Re: Shortest -return index of element in array- sub" created="2001-04-04 04:10:05" updated="2005-07-21 01:25:39">
<type id="11">
note</type>
<author id="62512">
mr_mischief</author>
<data>
<field name="doctext">
Now that I've taken a closer look, this is the shortest iterative version I could find (and also the shortest I could make it and have it run under strictures and warnings, although those aren't really prerequisites
in golf):
&lt;code&gt;
sub indexArray3{
 1while$_[0]ne pop;$#_
}
&lt;/code&gt;
I'd say that's pretty obfuscated, too. It can be done
in a couple fewer characters recursively, if you use a one-character subroutine name and eliminate any unnecessary whitespace. I'd like to know hoe to do it in fewer iteratively, but I just can't figure anything out. Please point it out to me if there's a way.
&lt;p&gt;
Chris Stith</field>
<field name="root_node">
66003</field>
<field name="parent_node">
69529</field>
</data>
</node>
