[Rd] Perl question
Fri Feb 21 21:16:03 2003
I sometimes hack something with a hash:
%keywords = ( "string1" => 1, "string2" => 1, "string3" => 1 )
and then do something like:
which should be true if $mystring is one of "string1", "string2", or
UCLA Department of Statistics
On Fri, 21 Feb 2003, Duncan Murdoch wrote:
> I'm working on the installer code, but I don't know Perl well enough.
> What is a good Perl equivalent of the R statement
> if ( s %in% c('string1', 'string2', 'string3') ) ...
> I can do it with
> if (s == "string1" || s == "string2" || s == "string3") ...
> but I've got a feeling there's a better way to do it using associative
> The real example will have about a dozen fixed strings that I want to
> search a few thousand times.
> Duncan Murdoch
> Rfirstname.lastname@example.org mailing list