[Cascavel-pm] Somar elementos numericos de um array

Igor Sutton Lopes igor.sutton em gmail.com
Segunda Abril 9 08:27:51 PDT 2007


On 2007/04/09, at 15:57, Patty Silva wrote:

> Pessoal.. tem como eu somar elementos numericos de um array?
> ex:
> @teste=(1,2,4,1,3,1,1,1,4,56,7,8,9);
> somar=1+2+4+1+3....

<code>
use List::Util qw(sum);

my $resultado = sum(@teste);
</code>

--
Igor Sutton
igor.sutton em gmail.com



-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20070409/33f6c784/attachment.html 
-------------- Próxima Parte ----------
Um anexo não texto foi limpo...
Nome  : PGP.sig
Tipo  : application/pgp-signature
Tam   : 186 bytes
Descr.: This is a digitally signed message part
Url   : http://mail.pm.org/pipermail/cascavel-pm/attachments/20070409/33f6c784/attachment.bin 


Mais detalhes sobre a lista de discussão Cascavel-pm