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

Re: [MacPerl] Newbie list question




Chris Nandor wrote:

>>Simple as it is, I can't see why this doesn't compile.
>>
>>@myList = ('a','b','c');
>>$x = @myList(1);
>>print "$x";

>Now, for your broken array access syntax.  All books describe the proper
>way to do this.

Quote from: Perl for Dummies. second edition page 100.  
**
Specifying slices of lists 

What happens if you want to address just one element of the list, and not 
the list in its entirety? Because lists are ordered, you can refer to 
each element by its numbered place in the list.  You can say to Perl  
"Set the variable $Dub to the value of the third element of the list 
@music." For example, 

$Dub = @Music(2);
**

(Below that slices are discussed). Apparently 100% of the books on Perl I 
currently have describe the improper way as well. Just thought it should 
work.

If a list of 'bugs' for the book is available somewhere, I'm looking 
forward to hear about it and I promise to check it first before bothering 
the @list.

In any case, I can't guarantee a bug-free tutorial (draft downloadable 
from: 
http://www.knoware.nl/users/bsfa/index.htm         )
given the amount of feedback I've received so far. On the positive side, 
in contrast to a cellulose-based tutorial, its upgrades are quick and, 
like the tutorial itself, free.

Bert

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