[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Newbie list question



On Sun, Apr 23, 2000 at 06:19:06PM +0200, Bert Altenburg wrote:
> 
> Hi,
> 
> Simple as it is, I can't see why this doesn't compile.
> 
> @myList = ('a','b','c');
> $x = @myList(1);
> print "$x";

() is for function calls; [] is for list indexing.  That should be:

$x = $myList[1];

You're only getting a single element from @myList, so you should use $
before the name instead of @.

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org