in reply to regex expression help

This should work
my @dependantFiles = ( 'aa', 'bb', 'cdef' ); my @namedFiles = ( 'cc', 'bb', 'dde' ); for my $y ( @dependantFiles ) { if( grep /$y/i, @namedFiles) { print "Found $y \n"; last; } else { print "not $y \n"; } }

Replies are listed 'Best First'.
Re^2: regex expression help
by bangers (Pilgrim) on Nov 08, 2005 at 17:21 UTC
    on second thoughts, probably best to use this:
    my @dependantFiles = ( 'aa', 'bb', 'cdef' ); my @namedFiles = ( 'cc', 'bb', 'dde' ); for my $y ( @dependantFiles ) { if( grep /^$y$/i, @namedFiles) { print "Found $y \n"; last; } else { print "not $y \n"; } }
    that way the file 'abc' in @namedFiles won't be tripped up if 'abcd' is in @dependantFiles