Peter Daum schreef: > my $x = undef; > foreach ( qw(a b c) ) { > my $t = $x if $x; > warn( "\$t == ", $t||'undef', "\n" ); > $t = $_; > } > > $t would be initialized with the value of $x if that was true; > otherwise (at least that's what I would expect) $t should be > undefined, > so the result would be as before. The real outcome, however, is: > > $t == undef > $t == a > $t == b > > $t now retains its value from the last loop iteration. > Is this a bug or a feature (tm)?
In a short and positive way: The runtime-actions attached to my(), which include resetting the value, are skipped when the condition says so. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/