[SP-pm] AJUDA em LOOPs

Moises Barboza desenvolvedorperl at gmail.com
Tue Jun 11 16:51:31 PDT 2013


Você pode fazer assim:

my @numeros = (1,2,3,4,5,6,7,8,9,10);

   my $key;

   foreach (@numeros) {
     if ( $_ == 5 )  {
        $key = $_;
        last;
     }
   }

   print "$key\n";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20130611/2a4d3bee/attachment-0001.html>


More information about the SaoPaulo-pm mailing list