Bonjour à tous.
Je suis sous Active Perl 5.8.3.809.
Soit le code suivant :Sortie attendue : "$it = t2 -- $tmp = t2"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 my @xdas = ( 't1', 't2', 't3' ); my ( $it, $tmp ); foreach $it (@xdas) { $tmp = $it; last if $it ge 't2'; } print "\$it = $it -- \$tmp = $tmp";
Sortie obtenue : "$it = -- $tmp = t2"
En sortant du foreach, $it passe undef.
Comment se fesse ????![]()
Partager