#!/usr/bin/perl -w use warnings; use strict; my @attfiles = ( 'foo.txt', 'faa.xml', 'fii.pdf' ); my @arcfiles = ( 'x:\archive\1234567890123_foo.txt', 'x:\archive\1234567890123_fuu.xml', 'x:\archive\1234567890123_fii.pdf' ); foreach my $att (@attfiles) { my $found = 0; foreach my $arc (@arcfiles) { if ( $arc =~ m/$att/ ) { print "Found $att in $arc\n"; $found = 1; last; } } unless ($found) { print "WARNING: Could not find $att\n"; } }