in reply to boolean IN(); function in perl like

Not sure, but what about a combination of join and index? I understand that both these functions are quite fast... Something like:
sub s_in_a { my $s = shift; my $joined = '#' . join('#', @_) . '#'; if (index($joined, "#$s#") >= 0) { return 1; } else { return 0; } }

Replies are listed 'Best First'.
Re^2: boolean IN(); function in perl like
by gaal (Parson) on Jan 18, 2005 at 11:37 UTC
    You then have to be picky about a delimiter. If the data has #s in it, this breaks.
      Yes, that's correct. You'd have to know in advance what characters are used in the data set before choosing a delimiter. Sometimes it is known, sometimes not.