Today I stumbled upon the Perl5 module For::Else. It adds an else block to a foreach loop:
foreach my $item (@items) {
#process each item
} else {
#handle the empty list case
}
I find it a very nice addition as I've written code like this:
if (@stuff) {
for my $thing (@stuff) {
..
}
} else {
..
}
many times. An else block would save keystrokes and would make the code
more readable. Python also has it.
What do you think?
--
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: [EMAIL PROTECTED]
