in reply to Mathching an array in regex

When you put an array into a string or regex literal, it gets expanded to join($", @arr) (/cool guy here/ in this case.)

Update: Added johngg's version for symetry. Originally, I only had the "Equals" version for grep.

Replies are listed 'Best First'.
Re^2: Mathching an array in regex
by johngg (Canon) on Oct 12, 2007 at 12:38 UTC
    I'm not sure that last code snippet is going to work. Perhaps using index inside the grep would?

    if ( grep { index($str, $_) != -1 } @arr ) { ...

    Cheers,

    JohnGG