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>