That's because identifiers like $myArray( ) return a value. Write your myArray alias to react to /myArray <index> <value> as well as $myArray(<index>). Here are three methods (you can pick one or develop something similar yourself) to work with $myArray() and /myArray.
Code:

;  $myArray(N)
;
;     Usage: $myArray(N)           - returns the value from the Nth array element
;            $myArray(0)           - returns the total number of elements in myArray
;
;  /myArray [-rcsl] [index] [value]
;
;     Usage: /myArray N value      - sets the Nth array element equal to value
;            /myArray -r N         - removes the value from the Nth array element
;            /myArray -c           - clears all the data from myArray
;            /myArray -s           - saves the current to the data file
;            /myArray -l           - loads myArray with previously saved data from the data file
;
;  -=[ Implemented using a hash table ]=-
;
alias myArray {
 
  if ($isid) {
 
    if ($$1 &gt; 0) $&amp;
      return $hget(myArray,$1)
 
    elseif ($1 == 0) $&amp;
      return $hget(myArray,0).item
 
  }
 
  elseif (($1 == -r) &amp;&amp; ($$2 &gt; 0)) $&amp;
    hdel myArray $$2
 
  elseif (($1 == -c) &amp;&amp; ($hget(myArray)) $&amp;
    hfree myArray
 
  elseif (($1 == -s) &amp;&amp; ($hget(myArray)) $&amp;
    hsave -o myArray myArray.dat
 
  elseif ($1 == -l) {
 
    if ((!$isfile(myArray.dat)) &amp;&amp; ($show)) $&amp;
      echo $color(info) -esbflirt * /myArray: no data file previously stored.
 
    else {
 
      if ($hget(myArray)) $&amp;
        .hfree myArray
 
      hmake myArray 10
      hload myArray myArray.dat
 
    }
 
  }
 
  elseif ($$1 &gt; 0) $&amp;
    hadd -m myArray $1 $$2
 
}
;
;  -=[ Implemented using an INI file ]=-
;
alias myArray {
 
  if ($isid) {
 
    if ($$1 &gt; 0) $&amp;
      return $readini(arrays.ini, myArray, $+(n,$1))
 
    elseif ($1 == 0) $&amp;
      return $ini(arrays.ini, myArray, 0)
 
  }
 
  elseif (($1 == -r) &amp;&amp; ($$2 &gt; 0)) $&amp;
    remini arrays.ini myArray $+(n,$$2)
 
  elseif ($1 == -c) $&amp;
    remini arrays.ini myArray
 
  elseif ($istok(-s:-l,$1,58)) $&amp;
    return
 
  elseif ($1 &gt; 0) $&amp;
    writeini arrays.ini myArray $+(n,$1) $$2-
 
}
;
;  -=[ Implemented using variables ]=-
;
alias myArray {
 
  if ($isid) {
 
    if ($$1 &gt; 0) $&amp;
      return $eval($+(%,myArray.,$$1)
 
    elseif ($1 == 0) $&amp;
      return $var(%myArray.*,0)
 
  }
 
  elseif (($1 == -r) &amp;&amp; ($$2 &gt; 0)) $&amp;
    .unset $+(%,myArray.,$$2)
 
  elseif ($1 == -c) $&amp;
    .unset %myArray.*
 
  elseif ($istok(-s:-l,$1,58)) $&amp;
    return
 
  elseif ($$1 &gt; 0) $&amp;
    set $+(%,myArray.,$1) $$2-
 
}

Now then, having said all that - personally, I think it would be much more efficient to script the actual array handler as $array(arrayName,N) and /array arrayName N value. You could script $arrayName() to use $array, thus hiding it from your script and reducing typing.
Code:

alias array {
 
  if ($isid) {
 
    if ($$2 &gt; 0) $&amp;
      return $hget(arrays,$+($1,.,$2))
 
    elseif ($2 == 0) $&amp;
      return $hfind(arrays,$+($1,.*),0,w)
 
  }
 
  elseif (($1 == -r) &amp;&amp; ($$3 &gt; 0)) $&amp;
    hdel arrays $+($2,.,$$3)
 
  elseif (($1 == -c) &amp;&amp; ($hfind(arrays,$+($2,.*),0,w))) $&amp;
    hdel -w arrays $+($2,.*)
 
  elseif (($1 == -s) &amp;&amp; ($hget(arrays))) $&amp;
    hsave -o arrays arrays.dat
 
  elseif ($1 == -l) {
 
    if ((!$isfile(arrays.dat)) &amp;&amp; ($show)) $&amp;
      echo $color(info) -esbflirt * /array: no data file previously stored.
 
    else {
 
      if ($hget(arrays)) $&amp;
        .hfree arrays
 
      hmake arrays 10
      hload arrays arrays.dat
 
    }
 
  }
 
  elseif ($$2 &gt; 0) $&amp;
    hadd -m arrays $+($1,.,$2) $$3
 
}
 
alias myArray {
 
  if ($isid) $&amp;
    return $array(myArray,$$1)
 
  elseif ($left($$1,1) == -) $&amp;
    array $1 myArray $$2-
 
  else $&amp;
    array myArray $1-
 
}

$myArray and /myArray would work exactly the same way as first described. The difference is that you could define multiple arrays using the same structure and use them the same way throughout your script without having to rescript each one because they all use $array and /array, thus they are all managed from the same array. You could replace the array alias with another method without hindering the performance of the rest of your script.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C