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

Re: [MacPerl] Multidimensional array question



At 01.59 -0500 1998.05.28, xavier wrote:
>What is with the "#" in the statements below?  I know that # usually means
>comment,
>but I do not understand how it is being used here.  Any help with this
>would be
>greatly appreaciated.  Thanks.

>From perldata.pod (Data Structures under the Help menu):

Scalar values are always named with '$', even when referring to a scalar
that is part of an array.  It works like the English word "the".  Thus we
have:

    $days               # the simple scalar value "days"
    $days[28]           # the 29th element of array @days
    $days{'Feb'}        # the 'Feb' value from hash %days
    $#days              # the last index of array @days

but entire arrays or array slices are denoted by '@', which works much like
the word "these" or "those":

    @days               # ($days[0], $days[1],... $days[n])
    @days[3,4,5]        # same as @days[3..5]
    @days{'a','c'}      # same as ($days{'a'},$days{'c'})

and entire hashes are denoted by '%':

    %days               # (key1, val1, key2, val2 ...)

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch