Oh! You right
Pop will suppress the last value from your array.

But my $LastValue = $ARRAY[ $#ARRAY-1 ];
Will not return the last element of the array neither.

my $LastValue = $ARRAY[$#ARRAY]; will do it.

@ar=qw(1 2 3 4 5);
$i=$ar[$#ar-1];
print "$i\n";
$i=$ar[$#ar];
print "$i\n";

Output:
4
5



-----Original Message-----
From: EUROSPACE SZARINDAR [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 1:40 
PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: Last value in a array?


Hi, 

You can use

my $LastValue = $ARRAY[ $#ARRAY-1 ];

The pop function suppress the last value of the ARRAY.


Michel

-----Message d'origine-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Date: vendredi 8 août 2003 12:57
À: [EMAIL PROTECTED]
Objet: Last value in a array?


Hi,

I have a couple of arrays which have different number of values - I need only the last 
value in each - are there a command to do that?

e.g

$array[LAST]  :-)

or maybe a way to count each value in a given array? and then feed the $array[??] with 
that?

Thanks,
Jakob

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



**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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

Reply via email to