[SP-pm] Subs

Marcio Ferreira marciodesouzaferreira at gmail.com
Sat Mar 23 09:32:36 PDT 2013


2013/3/23 Marcio Ferreira <marciodesouzaferreira at gmail.com>
>
>>
>> sub somaValor {
>>     my ($a,$b)=undef;
>
>
> Por que essa linha? Evitar problema com globais?

Até porque, somente "$a" está recebendo "undef", talvez você quisesse "my
($a,$b)=(undef, undef)" ou simplesmente "my ($a,$b)".

$ perl -E'$a=12;$b=15;($a,$b)=5;say $a,$b'
5

faço muito: "my ($a,$b)=@_;" direto, o que pra mim é uma recomendação(lendo
o http://modernperlbooks.com, ele não tem )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20130323/7b3f0835/attachment-0001.html>


More information about the SaoPaulo-pm mailing list