my @a = (2 .. 9); my @i = (2, 3, 5); delete @a[@i]; my @b = grep defined, @a;