in reply to if else and not reachable coding style
Well you could also write
sub sg { (COND) && return 1; return 2; } [download]
But for clarity I would definitely prefer your first suggestion (especially if, as you say, things are a bit more complicated).