From murdoch@stats.uwo.ca  Fri Feb 21 20:50:49 2003
From: murdoch@stats.uwo.ca (Duncan Murdoch)
Date: Fri Feb 21 20:50:49 2003
Subject: [Rd] Perl question
Message-ID: <e30d5voq9g2pb71vqqeqk1ev05jb9os5i0@4ax.com>

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
arrays.  

The real example will have about a dozen fixed strings that I want to
search a few thousand times.

Duncan Murdoch



[Rd] Perl question
Duncan Murdoch