in reply to Array comparison for 3 arrays

This is crossposted here:

http://perlguru.com/gforum.cgi?post=45712

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: Array comparison for 3 arrays
by ikegami (Patriarch) on Apr 15, 2010 at 04:32 UTC

    roolic's answer is flawed. Building a hash is smart, but building it over and over again is dumb. Even

    sub exists { my ($array, $value) = @_; return grep $_ eq $value, @$array; } exists( $arr_ref, $value ) ? 'yes' : ''
    would be better than
    sub exists { my ($array, $value) = @_; my %all_vals = map { $_=>1 } @{$array}; return $all_vals{$value}; } exists( $arr_ref, $value ) ? 'yes' : ''
Re^2: Array comparison for 3 arrays
by Anonymous Monk on Apr 15, 2010 at 03:54 UTC

    Hi all, thanks for all your input, help and suggestions. Although some of the examples are difficult to understand but I appreciate the effort... I'm beginning to get the idea and concept and will do some study on some these examples given here...

    The reason I cross post to a few forums is I will get as many examples as possible with one that I hopefully will understand... Will take note of that in the future.

    Thanks again all

      The reason I cross post to a few forums is I will get as many examples as possible
      This is of course the only reason why people crosspost. But if you do this, you should at the very least include in your posting where you crosspost.

      -- 
      Ronald Fischer <ynnor@mm.st>