Why the double semantics of 'when'?
It implicitly breaks when used as a 'when' block, but does not as a 'when'
statement. It seems that a when should be a when should be a when, and a
when being a when would be a win.
The example given:
given $x {
warn("Odd value") when !/xxx/;
warn("No value"), break when undef;
when /aaa/ { break when 1; ... }
when /bbb/ { break when 2; ... }
when /ccc/ { break when 3; ... }
}
could be written as:
given $x {
warn("Odd value"), skip when !/xxx/;
warn("No value") when undef;
when /aaa/ { break when 1; ... } # No reason you can't
when /bbb/ { break when 2; ... } # explicitly break even when
when /ccc/ { break when 3; ... } # you'd implicitly
}
or even:
given $x {
warn("Odd value") if !/xxx/; # Since $_ is the localizer
warn("No value") when undef;
when /aaa/ { break if 1; ... }
when /bbb/ { break if 2; ... }
when /ccc/ { break if 3; ... }
}
--
Bryan C. Warnock
[EMAIL PROTECTED]