in reply to Need help with removing values from arrays

G'day GrizzlyRizly,

Welcome to the Monastery.

That sounds like you're using one of the many GUIs available in Perl: you need to state which. These GUIs can have multiple combobox widgets: again, you need to state which.

When a combobox item is selected, GUIs can provide various types of information about the selection, such as an index or a string.

If you have an index, and don't care about preserving the original array, perhaps use splice.

$ perl -E 'my @x = qw{a b c}; say "@x"; splice @x, 1, 1; say "@x"' a b c a c

If you have an index, but do care about preserving the original array, perhaps use a slice.

$ perl -E 'my @x = qw{a b c}; say "@x"; my @y = @x[0,2]; say "@y"' a b c a c

If you have the selection as a string, and do care about preserving the original array, perhaps create a new array using grep.

$ perl -E 'my @x = qw{a b c}; say "@x"; my $sel = "b"; my @y = grep { +$_ ne $sel } @x; say "@y"' a b c a c

There's other ways to do this depending on your requirements. You should really show us some sample code (see SSCCE): we might be able to suggest a completely different approach when we have a better idea what you're currently doing. Also see the guidelines in "How do I post a question effectively?" for tips on the type of information to provide us with.

— Ken

Replies are listed 'Best First'.
Re^2: Need help with removing values from arrays
by GrizzlyRizly (Novice) on Aug 15, 2017 at 05:50 UTC

    Hi, i have updated the information given, please tell me if i need to give anymore information and i will gladly do so, thanks.

      When you update a post, it is important to indicate what you have changed. You should be careful not to invalidate any existing reply which refers to the original post.
      Bill