Yah, there is.
sub Switcheroo {
my @conditions = @_;
if ($conditions[0] < 10) {
return 'FOO';
} else {
return 'BAR';
}
}
The point is to encapsulate the strategy of determining which direction to go. That's what a switch statement does. This is, basically, a Switch object. (An example of a Strategy pattern, for those following along at home.)
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.