in reply to Re^2: Accessing secondary elements in array
in thread Accessing secondary elements in array

A few assumptions, "bold text" is the part of the text that is surrounded by [b] and [/b]. "bold text" isn't nested inside "bold text", and there's at most one piece of "bold text" per string. Strings not containing any bold text is to be ignored.

Then I would do something like (not tested):

my %seen; m{\[b\](.*?)\[/b\]} and $seen{$1} = 1 for @array1; my @result = grep {m{\[b\](.*?)\[/b\]} && !$seen{$1}} @array2;

Replies are listed 'Best First'.
Re^4: Accessing secondary elements in array
by chavanak (Initiate) on Nov 04, 2009 at 13:00 UTC
    Hi, Thanks for the reply but the first assumption itself is not true, the bold tags were added just to differentiate the text that has to be used for comparing. Can you please let me know any other idea I can proceed with? Cheers
      You could have fooled me, as [b] isn't HTML for bold (you did actually preview your post, did you?). Perhaps you mean you want to compare white space separated columns - use split. Perhaps you mean you want to compare fixed width & fixed offset substring, use substr. Perhaps you mean something else that cannot be easily determined from the examples given.

      Being able to actually describe your problem means you're more than halfway to the solution.