in reply to Re: Multi @array searches
in thread Multi @array searches

Those two solutions differ quite a bit. Something closer to the original would be:

$terms =~ s/^\s*//; $terms =~ s/\s*$//; $terms =~ s/\s+/|/g;
because split " " actually splits on any amount of whitespace while ignoring both leading and trailing spaces.

Of course, if you can guarantee that the input has no lead, trailing, nor repeated spaces (and no zero-width terms), then your solution would work.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Multi @array searches
by jorg (Friar) on Mar 22, 2001 at 22:49 UTC
    subtle difference but very true tye, didn't think of that one!
    at least my solution is correct 'ceteris paribus' .. probably never the best assumption to make, but hey it's getting late in the day :)