in reply to searching in array elements substrings contained in another array

foreach my $q (@quadruple) { @triple = grep {$q !~ /$_/} @triple; }
  • Comment on Re: searching in array elements substrings contained in another array
  • Download Code

Replies are listed 'Best First'.
Re^2: searching in array elements substrings contained in another array
by Anonymous Monk on Nov 17, 2008 at 20:30 UTC
    Thank you for the ultrafast reply... but it seems it soesn't work... Or better: the first cycle works, but when it comes to use the previously processed array (@triple), a long list of warning comes:
    Use of uninitialized value in pattern match (m//)
    and the matches don't work. Printing the two arrays gives that the matches have not been removed... Any idea? Thank you again Livius

      How can undef values fall into @triple array?

      Anyway here is the fix:

      foreach my $q (@quadruple) { @triple = grep {$_ and $q !~ /$_/} @triple; }
        Thank you ccn! Now it works wonderfully! I'm grateful for the precious help Best regards Livius