> -----Original Message-----
> From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 13, 2001 11:07 PM
> To: Beginners@Perl. Org (E-mail)
> Subject: Dereference question:
> 
> 
> Hello 
> Do's anyone know how to create an array slice containing 2 
> elements and
> dereference to a @newarray
> I'm just starting to learn how to deference but would like a code
> example....

An array slice is just a list. There's nothing to dereference.

For example:

   @a = qw(foo bar baz);      # @a is an array
   @b = @a[0,2];              # @a[0,2] is a slice containing
                              # 2 elements (foo baz). This list 
                              # is assigned to new array @b

If you have a reference to an array, it would look like this:

   $a = [ qw(foo bar baz) ];  # $a is a reference to an array
   @b = @$a[0,2];             # slice same 2 elements from
                              # the array referenced by $a



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to