[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] find value in array



At 7:03 PM 10/14/00, g3pb wrote:
>is there a way other then using foreach to determie if an array contains a
>particular value. in AppleScript it would be
>
>if list contains value then
>     -- do stuff
>end if
>


There's nothing quite as simple as that, but you can collapse the 
array into a string and check for a pattern match:

if (join('', @list) =~ /$value/) {
   # do stuff
}

HTH

1;
- Bruce

__Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org