in reply to Re: Array element removal
in thread Array element removal

Assuming that the critical value has to be in the second position in the array, and if you don't mind building up a new array to replace the old one:
my @new_data; for my $i ( 0 .. $#data ) { $data[$i][1] != $compare[$i] and push @new_data; } # replace: @data = @new_data;
As an aside, you are using global variables unnecessarily. Your code will be a lot clearer and cleaner, and less error prone, if you use lexical variables properly. use warnings; and use strict; to let perl help you write better code.

jdporter
...porque es dificil estar guapo y blanco.

Replies are listed 'Best First'.
Re: Re: Re: Array element removal
by sauoq (Abbot) on Dec 17, 2002 at 23:34 UTC

    I assume that he doesn't want the second elements in the arrays referenced in @data to be contained anywhere in @compare. Your code only checks elements in @data and @compare with the same index. The question wasn't very well stated though.

    -sauoq
    "My two cents aren't worth a dime.";
    

      Your crystal ball must be tuned better than mine ;^)

      If your interpretation is the question that was asked, even with the insight of your interpretation, I can't derive the filter to extract that signal from the noise.


      Examine what is said, not who speaks.