BTW, what George is showing there is an Array Slice.  That's why the @
symbol is used instead of the $ symbol.  I'd recommend looking it up in the
perldocs.

-----Original Message-----
From: George Schlossnagle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 08, 2002 9:26 AM
To: Frank Wiles
Cc: Diego Riano; [EMAIL PROTECTED]
Subject: Re: Joining array elements


join ",", @array[2...$#array];

works nicely for me.

Frank Wiles wrote:

> .------[ Diego Riano wrote (2002/10/08 at 16:50:41) ]------
> | 
> |  Hello all
> |  
> |  I have an array like this:
> |  
> |  @array=(1,2,3,4,5,6);
> |  
> |  And I would like to join the element starting from the third one until
> |  the lasta want.  Something like:
> |  
> |  join (",",$array[2],$array[3],$array[4],$array[5]);
> |  
> |  The problem I have is that this array will chance from time to time
> |  sometimes being bigger sometimes being smaller, so I need a way to join
> |  the elements from the third element to last one..
> |  any Ideas!!
> |  
> `-------------------------------------------------
>
>    Easiest way would be something along the lines of: 
>
>    # Build a temporary array 
>    my @tmp_array = @array; 
>
>    # remove the first two elements 
>    shift(@tmp_array); 
>    shift(@tmp_array); 
>
>    join(",", @tmp_array); 
>
>    Hope this helps. 
>
> ---------------------------------
>   Frank Wiles <[EMAIL PROTECTED]>
>   http://frank.wiles.org
> ---------------------------------
>
>




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

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

Reply via email to