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

Re: [MacPerl] Newbie list question



At 21.11 +0200 2000.04.23, Bert Altenburg wrote:
>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);
>**

If it says this, it is completely wrong.  In @Music(2), the first character
should be $ not @, and the ( should be a [, and the ) should be a ].


>(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.

I have never seen any book that says () should be used for array indexes
instead of [].  And I have seen a few (very wrong) references to using @ in
place of $ for a single array index, but never in a book (though I've heard
about it before).  Any book that does () instead of [] is horrible.  Any
book that does @ instead of $ is very bad.


>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.

Just return it if you can (say it is defective, because it clearly is) and
get something else.  The MacPerl book may be a good choice (and I don't say
that just because I am coauthor :).  Learning Perl from O'Reilly is pretty
good.  If you some good programming experience, Perl: Programmer's
Companion is excellent.  There are others, but frankly, most Perl
introductory texts are not very good.  As mentioned, see Tom Christiansen's
(somewhat outdated) page:

    http://language.perl.com/critiques/

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

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