in reply to Use an array slices

An alternative to the 'switch' is using a dispatch array. I'm assuming for the following that $some_obj->get_status returns an integer number, otherwise this number has to be extracted from the return value:
# choice number 0 1 2 3 4 5 6 my @choices = ([0,6], [0..2], [2..5], [3], [4], [2,5], [6]); my $num = $some_obj->get_status; my @newlist = @list[ @{ $choices[$num] } ]; local $"=', '; print "Result: status = $num; list=@newlist";

-- Hofmator