> In the following code fragment, what context is foo() in?
   > 
   >     @ary[0] = foo()

Scalar context. @ary[0] is a single element of @ary.

To call foo() in list context use any of the following:

        (@ary[0]) = foo();      # Assign @ary[0] the first element returned
        @(@ary[0]) = foo();     #   "      "      "    "      "       "
        @ary[@(0)] = foo();     #   "      "      "    "      "       "
        @ary[0,] = foo();       #   "      "      "    "      "       "
        @ary[[0]] = foo();      #   "      "      "    "      "       "

        @ary[0] = @(foo());     # Assign @ary[0] a ref to the elems returned
        @ary[0] =()= foo();     #   "      "     "  "  "   "    "      "
        @ary[0] = [foo()];      #   "      "     "  "  "   "    "      "

Damian

Reply via email to